.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\" %sccs.include.redist.man%
.\" @(#)getitimer.2 8.2 (Berkeley) %G%
.Nd get/set value of interval timer
.Fd #include <sys/time.h>
.Fd #define ITIMER_REAL 0
.Fd #define ITIMER_VIRTUAL 1
.Fd #define ITIMER_PROF 2
.Fn getitimer "int which" "struct itimerval *value"
.Fn setitimer "int which" "struct itimerval *value" "struct itimerval *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
.Bd -literal -offset indent
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
(typically 10 milliseconds).
timer decrements in real time. A
delivered when this timer expires.
timer decrements in process virtual time.
It runs only when the process is executing. A
is delivered when it expires.
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
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
parameter specified a bad address.
parameter specified a time that was too large
function call appeared in