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 provided 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 non-zero, it indicates a repetitive timer period.

Returns:

The timer_gettime() function returns zero on success. On error, it returns (-1), and errno is set.

Errors:

EINVAL
The timer timerid is not attached to the calling process.

See also:

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

Examples:

See timer_create().

Classification:

POSIX 1003.4

Systems:

QNX