[Previous]
[Contents]
[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 );

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 pointed to by the value argument. The timer is specified by timerid.

The itimerspec structure pointed to by value contains at least the following members:

struct timespec it_value
This member contains the amount of time left before the timer expires, or zero if the timer is disarmed. This value is returned as the relative interval until expiration, even if the timer was armed with absolute time.
struct timespec it_interval
This member contains the timer's reload value. If nonzero, it indicates a repetitive timer period.

Returns:

0
Success
-1
An error occurred. errno is set to indicate the error.

Errors:

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

Examples:

See timer_create().

Classification:

POSIX 1003.4

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

clock_getres(), clock_gettime(), clock_setres(), clock_settime(), errno, nanosleep(), sleep(), ticksize utility, timer_create(), timer_delete(), timer_settime()


[Previous]
[Contents]
[Next]