[Previous] [Contents] [Index] [Next]

timer_gettime()

Get the amount of time left on a timer

Synopsis:

#include <time.h>

int timer_gettime( timer_t timerid,
                   struct itimerspec *value );

Arguments:

timerid
The ID of the timer.
value
A pointer to a itimerspec structure that contains at least the following members:
struct timespec it_value
A timespec structure that contains the amount of time left before the timer expires, or zero if the timer is disarmed. This value is expressed as the relative interval until expiration, even if the timer was armed with an absolute time.
struct timespec it_interval
A timespec structure that contains the timer's reload value. If nonzero, it indicates a repetitive timer period.

Library:

libc

Description:

The timer_gettime() function gets the amount of time left before the specified timer is to expire, along with the timer's reload value, and stores it in the space provided by the value argument.

Returns:

0
Success.
-1
An error occurred (errno is set).

Errors:

EINVAL
The timer timerid isn't attached to the calling process.

Classification:

POSIX 1003.1 (Realtime Extensions)

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

clock_getres(), clock_gettime(), clock_settime(), errno, nanosleep(), sleep(), timer_create(), timer_delete(), timer_settime(), timespec


[Previous] [Contents] [Index] [Next]