![]() |
![]() |
![]() |
![]() |
Set the expiration time for a timer
#include <time.h> int timer_settime( timer_t timerid, int flags, struct itimerspec * value, struct itimerspec * ovalue );
libc
The timer_settime() function sets the expiration time of the timer specified by timerid from the it_value member of the value argument. If the it_value structure member of value is zero, then the timer is disarmed.
If the it_interval member of value is nonzero, then it specifies a repeat rate that is added to the timer once the it_value period has expired. Subsequently, the timer is automatically rearmed, causing it to become continuous with a period of it_interval.
If the timer isn't disarmed then the flags argument determines the type of timer to arm.
The flags argument can contain any of the following control bits:
If this bit isn't set, then the it_value represents a relative expiration period that is offset from the current system time by the specified number of seconds and nanoseconds.
If the ovalue parameter isn't NULL, then on return from this function it contains a value representing the previous amount of time left before the timer was to have expired, or zero if the timer was disarmed. The previous interval timer period is also stored in the it_interval member.
The timerid is local to the calling process, and must have been created using timer_create().
See timer_create().
POSIX 1003.1 (Realtime Extensions)
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
clock_getres(), clock_gettime(), clock_settime(), errno, nanosleep(), sleep(), timer_create(), timer_delete(), timer_gettime()
![]() |
![]() |
![]() |
![]() |