Updated: April 19, 2023 |
Get the value of an interval timer
#include <sys/time.h> int getitimer ( int which, struct itimerval *value );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The getitimer() function stores the current value of the timer specified by which into the structure pointed to by value.
A timer value is defined by the itimerval structure, which includes the following members:
struct timeval it_interval; /* timer interval */ struct timeval it_value; /* current value */
Each struct timeval contains the following members:
The it_value member indicates the time to the next timer expiration. The it_interval member specifies a value to be used in reloading it_value when the timer expires. An it_value of 0 represents a timer that is disabled, regardless of the value of it_interval. An it_interval of 0 represents a timer that will not be reloaded after its next expiration (assuming it_value is nonzero).
Time values smaller than the resolution of the system clock are rounded up to the resolution of the system clock.
The interval timers include:
POSIX 1003.1 OB XSI. This function is marked as obsolescent, and may be removed from a future version of the standard.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |