getitimer()

Get the value of an interval timer

Synopsis:

#include <sys/time.h>

int getitimer ( int which,
                struct itimerval *value );

Since:

BlackBerry 10.0.0

Arguments:

which
The interval time whose value you want to get. Currently, this must be ITIMER_REAL.
value
A pointer to a itimerval structure where the function can store the value of the interval timer.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The system provides each process with several interval timers, defined in <sys/time.h>. 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:

  • time_t tv_sec — the number of seconds since the start of the Unix Epoch.
  • suseconds_t tv_usec — the number of microseconds.

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. Setting it_value to 0 disables a timer, regardless of the value of it_interval. Setting it_interval to 0 disables a timer 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:

ITIMER_REAL
Decrements in real time. A SIGALRM signal is delivered when this timer expires.

Returns:

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

Errors:

EINVAL
The specified number of seconds is greater than 100,000,000, the number of microseconds is greater than or equal to 1,000,000, or the which argument is unrecognized.

Classification:

POSIX 1003.1 XSI

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

Last modified: 2014-06-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus