timer_settime - Online Linux Manual PageSection : 2
Updated : 2022-12-03
Source : Linux man-pages 6.03
NAMEtimer_settime, timer_gettime − arm/disarm and fetch state of POSIX per-process timer
LIBRARYReal-time library (librt, −lrt)
SYNOPSIS#include <time.h>int timer_settime(timer_t timerid, int flags,
const struct itimerspec *restrict new_value,
struct itimerspec *_Nullable restrict old_value);
int timer_gettime(timer_t timerid, struct itimerspec *curr_value);Feature Test Macro Requirements for glibc (see feature_test_macros(7)): timer_settime(), timer_gettime(): _POSIX_C_SOURCE >= 199309L
DESCRIPTIONtimer_settime() arms or disarms the timer identified by timerid. The new_value argument is pointer to an itimerspec structure that specifies the new initial value and the new interval for the timer. The itimerspec structure is described in itimerspec(3type). Each of the substructures of the itimerspec structure is a timespec(3) structure that allows a time value to be specified in seconds and nanoseconds. These time values are measured according to the clock that was specified when the timer was created by timer_create(2). If new_value−>it_value specifies a nonzero value (i.e., either subfield is nonzero), then timer_settime() arms (starts) the timer, setting it to initially expire at the given time. (If the timer was already armed, then the previous settings are overwritten.) If new_value−>it_value specifies a zero value (i.e., both subfields are zero), then the timer is disarmed. The new_value−>it_interval field specifies the period of the timer, in seconds and nanoseconds. If this field is nonzero, then each time that an armed timer expires, the timer is reloaded from the value specified in new_value−>it_interval. If new_value−>it_interval specifies a zero value, then the timer expires just once, at the time specified by it_value. By default, the initial expiration time specified in new_value−>it_value is interpreted relative to the current time on the timer's clock at the time of the call. This can be modified by specifying TIMER_ABSTIME in flags, in which case new_value−>it_value is interpreted as an absolute value as measured on the timer's clock; that is, the timer will expire when the clock value reaches the value specified by new_value−>it_value. If the specified absolute time has already passed, then the timer expires immediately, and the overrun count (see timer_getoverrun(2)) will be set correctly. If the value of the CLOCK_REALTIME clock is adjusted while an absolute timer based on that clock is armed, then the expiration of the timer will be appropriately adjusted. Adjustments to the CLOCK_REALTIME clock have no effect on relative timers based on that clock. If old_value is not NULL, then it points to a buffer that is used to return the previous interval of the timer (in old_value−>it_interval) and the amount of time until the timer would previously have next expired (in old_value−>it_value). timer_gettime() returns the time until next expiration, and the interval, for the timer specified by timerid, in the buffer pointed to by curr_value. The time remaining until the next timer expiration is returned in curr_value−>it_value; this is always a relative value, regardless of whether the TIMER_ABSTIME flag was used when arming the timer. If the value returned in curr_value−>it_value is zero, then the timer is currently disarmed. The timer interval is returned in curr_value−>it_interval. If the value returned in curr_value−>it_interval is zero, then this is a "one-shot" timer.
RETURN VALUEOn success, timer_settime() and timer_gettime() return 0. On error, −1 is returned, and errno is set to indicate the error.
ERRORSThese functions may fail with the following errors: EFAULT new_value, old_value, or curr_value is not a valid pointer. EINVAL timerid is invalid. timer_settime() may fail with the following errors: EINVAL new_value.it_value is negative; or new_value.it_value.tv_nsec is negative or greater than 999,999,999.
VERSIONSThese system calls are available since Linux 2.6.
STANDARDSPOSIX.1-2001, POSIX.1-2008.
EXAMPLESSee timer_create(2).
SEE ALSOtimer_create(2), timer_getoverrun(2), timespec(3), time(7) 0
Johanes Gumabo
Data Size : 13,697 byte
man-timer_gettime.2Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 3 / 236,976
Visitor ID : :
Visitor IP : 3.16.212.203 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.