Table of Contents
The
system provides each process with three interval timers, defined in The
call returns the current value for the timer specified in in the structure
at The call sets a timer to the specified (returning the previous value
of the timer if is non-nil). A timer value is defined by the structure:
struct itimerval { struct timeval it_interval; /* timer interval */
struct timeval it_value; /* current value */
}; If is non-zero, it indicates the time to the next timer expiration.
If is non-zero, it specifies a value to be used in reloading when the
timer expires. Setting to 0 disables a timer. Setting to 0 causes a
timer to be disabled after its next expiration (assuming is non-zero).
Time values smaller than the resolution of the system clock are rounded
up to this resolution (typically 10 milliseconds). The timer decrements
in real time. A signal is delivered when this timer expires. The timer
decrements in process virtual time. It runs only when the process is executing.
A signal is delivered when it expires. The 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 of interpreted programs. Each time the timer expires, the 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 work with this macro).
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
and will fail if: The parameter specified a
bad address. A parameter specified a time that was too large to be handled.
The function call appeared in
Table of Contents