.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\" @(#)getitimer.2 6.1 (Berkeley) %G%
getitimer, setitimer \- get/set value of interval timer
#define ITIMER_REAL 0 /* real time intervals */
#define ITIMER_VIRTUAL 1 /* virtual time intervals */
#define ITIMER_PROF 2 /* user and system virtual time */
setitimer(which, value, ovalue)
struct itimerval *value, *ovalue;
The system provides each process with three interval timers,
call returns the current value for the timer specified in
call sets a timer to the specified
(returning the previous value of the timer if
A timer value is defined by the
struct timeval it_interval; /* timer interval */
struct timeval it_value; /* current value */
is non-zero, it indicates the time to the next timer expiration.
is non-zero, it specifies a value to be used in reloading
to 0 disables a timer. Setting
to 0 causes a timer to be disabled after its next expiration (assuming
Time values smaller than the resolution of the
system clock are rounded up to this resolution
(on the VAX, 10 milliseconds).
The ITIMER_REAL timer decrements in real time. A SIGALRM signal is
delivered when this timer expires.
The ITIMER_VIRTUAL timer decrements in process virtual time.
It runs only when the process is executing. A SIGVTALRM signal
is delivered when it expires.
The ITIMER_PROF timer decrements both in process virtual time and
when the system is running on behalf of the process. It is designed
to be used by interpreters in statistically profiling the execution
Each time the ITIMER_PROF timer expires, the SIGPROF signal is
delivered. Because this signal may interrupt in-progress
system calls, programs using this timer must be prepared to
restart interrupted system calls.
Three macros for manipulating time values are defined in
sets a time value to zero,
tests if a time value is non-zero, and
compares two time values (beware that >= and <= do not
If the calls succeed, a value of 0 is returned. If an error occurs,
the value \-1 is returned, and a more precise error code is placed
in the global variable \fIerrno\fP.
The \fIvalue\fP structure specified a bad address.
A \fIvalue\fP structure specified a time was too large
sigvec(2), gettimeofday(2)