timer_settime(3C)timer_settime(3C)NAMEtimer_settime - set the expiration time for a posix timer
SYNOPSIS
#include <time.h>
int timer_settime (timer_t timerid, int flags,
const struct itimerspec *value, struct itimerspec *ovalue);
DESCRIPTIONtimer_settime sets the expiration time for the posix timer named by
timerid. The timespec_t it_value field of value is used to specify the
desired timer expiration time. If the timer was previously set and has
not expired, then the timer is reset to the specified it_value. In the
event it_value is set to zero, the timer is disarmed.
By default, posix timers interpret specified expiration times to be
relative to the time of the timer_settime call. Therefore, the timer
will expire in it_value nanoseconds from when the call is made. This
behavior, however, may be altered using the flags parameter. If the
TIMER_ABSTIME flag is set, then the timer will interpret the specified
expiration time to be absolute in respect to the clock associated with
timerid. Hence, the timer will expire when the clock reaches the
specified it_value. If TIMER_ABSTIME is selected and the specified
expiration time has already elapsed, the call will succeed and expiration
notification will be delivered.
The periodic interval time for which subsequent timer expirations occur
may be set using the it_interval field of value. If it_interval is set
to zero, then the timer will only expire once, as specified by it_value.
If ovalue is not set to NULL, then the previous time remaining before
timerid expiration is stored at memory address ovalue.
timer_settime will fail if one or more of the following are true:
[EINVAL] The timerid does not name a valid posix timer.
[EINVAL] value contained a nanosecond value greater than 1000 million
or less than zero.
[EFAULT] The address specified by either value or ovalue is outside
the range of the address space of the calling process.
SEE ALSOtimer_create(3C), timer_delete(3C), timer_getoverrun(3C),
timer_gettime(3C), clock_settime(2), clock_gettime(2), clock_getres(2),
getitimer(2), setiitimer(2)
Page 1
timer_settime(3C)timer_settime(3C)DIAGNOSTICS
Upon successful completion, a value of 0 is returned to the calling
process. Otherwise, a value of -1 is returned and errno is set to
indicate the error.
Page 2