Get the amount of time left on a timer
#include <time.h> int timer_gettime( timer_t timerid, struct itimerspec *value );
- A timer_t object that holds a timer ID, as set by timer_create().
- A pointer to a itimerspec structure that the function
fills in with the timer's time until expiry.
The structure 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.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
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.
In order to get timer information, your process must have the PROCMGR_AID_TIMER ability enabled. For more information, see procmgr_ability().
- An error occurred ( errno is set).
- The timer timerid isn't attached to the calling process.
- The calling process doesn't have the required permission; see procmgr_ability().
Last modified: 2014-06-24