getitimer, setitimer
Purpose
Gets and sets value of internal timer.
Library
Berkeley Library (libbsd.a)
Syntax
#include <bsd/sys/time.h>
int getitimer (which, value) int setitimer (which, value, ovalue)
int which; int which;
struct itimerval *value; struct itimerval *value, *ovalue;
Description
The getitimer subroutine returns the current value of the
timer specified in which. The setitimer subroutine sets
the timer in which to the specified value, returning the
previous value of the timer if ovalue is not 0.
The itimerval structure describes the timer value, as
defined in the bsd/sys/time.h header file, and it con-
tains the following members:
struct timeval it_interval; /* timer interval */
struct timeval it_value; /* current value */
Setting it_interval to 0 disables the timer after it
expires. An it_interval other than 0 specifies a value
used to reload it_value when the timer expires.
The it_value disables the timer immediately when set to
0. An it_value other than 0 indicates the time of the
next timer expiration.
Time values smaller than the resolution of the system
clock are rounded up to its resolution, 1/60th of a
second.
The ITIMER_REAL timer decrements in real time. When it
expires, the system delivers a SIGALRM signal. Timer
values ITIMER_VIRTUAL and ITIMER_PROF are not supported.
Return Value
Upon successful completion, a value of 0 is returned.
Otherwise, a value of -1 is returned, and errno is set to
indicate the error.
Diagnostics
The getitimer or setitimer subroutine fails if one or
more of the following is true:
EFAULT The value or ovalue parameter &pointsout..
EINVAL The value parameter specifies a time too large
to handle.
EINVAL The which parameter specifies an illegal
value.
Related Information
In this book: "gettimeofday" and "sigvec."