Go to the previous, next section.
int getitimer(int which, struct itimerval
*value);
int setitimer(int which, const struct itimerval
*value, struct itimerval *ovalue);
which: [in] the timer to access.
value: (For getitimer) [out] the value of the timer.
(For setitimer) [in] the new value of the timer.
ovalue: [out] the old value of the timer.
Each task posess 3 interval timers:
ITIMER_REAL
SIGALRM upon expiration.
ITIMER_VIRTUAL
SIGVTALRM upon expiration.
ITIMER_PROF
SIGPROF upon expiration. The structure itimerval has the following structure:
struct itimerval {
struct timeval it_interval; /* timer interval */
struct timeval it_value; /* current value */
};
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* microseconds */
};
getitimer gets those values for a specific timer and
setitimer sets those values for a specific timer (and also retrieve
the old values). If it_value or it_interval is set to
0 the timer is deactivated. The timers always expire at or after the requested
time. If the requesting process is active at the moment of expiration a signal
is immediately delivered otherwise the delivery may be delayed.
On success zero is returned. On error -1 is returned and errno
is set to one of the following values:
EINVAL: which has an invalid value.
EFAULT.