GETITIMER(2)GETITIMER(2)NAME
getitimer, setitimer - get and set value of interval timer
SYNOPSIS
#include <sys/time.h>
int getitimer(int which, struct itimerval *value)
int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue);
DESCRIPTION
Getitimer retrieves the current value of the given interval timer, in
value.
Setitimer sets a new value for the given interval timer, as given in
value, and, if ovalue is not set to NULL, stores the old value for the
interval timer in ovalue.
For both functions, the which parameter indicates which of the interval
timers they work on; which can have one of the following values:
ITIMER_REAL A timer that is decremented in realtime. When it
expires, a SIGARLM signal is delivered to the process.
ITIMER_VIRTUAL A timer that is decremented in process user time. When
it expires, a SIGVTALRM signal is delivered to the
process.
ITIMER_PROF A timer that is decremented in process user+system time.
When it expires, a SIGPROF signal is delivered to the
process.
The specified timer will first expire after the time specified in the
'it_value' field of the itimerval structure. Similarly, upon retrieval
the 'it_value' field will contain the time after which the timer will
expire.
If 'it_value' is zero, then the timer is disabled, and the 'it_inter‐
val' field is ignored and (upon retrieval) set to zero. Otherwise,
'it_interval' contains the repetition interval after which the timer
will repeatedly expire, starting from the moment that the timer expires
for the first time according to the 'it_value' value. If 'it_interval'
is set to zero, no repetition will occur.
The maximum supported timeout value that setitimer accepts, depends on
the clock tick rate of the operating system.
These functions share their real-time timer with alarm(2). Therefore,
use of both types of functions in one program yields undefined results.
RETURN VALUES
Upon successful completion, these functions return 0. Otherwise, a
value of -1 is returned and errno is set to indicate the error.
ERRORS
The functions will fail if any of the following occur:
EINVAL Either which is not one of the ITIMER_* constants above,
or one of the timeval structures in value contains a bad
or too large value.
EFAULT Bad value or ovalue address.
SEE ALSOalarm(2)AUTHOR
David van Moolenbroek <dcvmoole@cs.vu.nl>
4th Berkeley Distribution April 14, 2006 GETITIMER(2)