setitimer

Sets the value of interval timers.

Format

#include  <time.h>

int setitimer  (int which, struct itimerval
               *value, struct itimerval *ovalue);

Arguments

which
The type of interval timer. The DEC C RTL only supports ITIMER_ REAL.
value
A pointer to an itimerval structure whose members specify a timer interval and the time left to the end of the interval.
ovalue
A pointer to an itimerval structure whose members specify a current timer interval and the time left to the end of the interval.

Description

This function sets the timer specified by which to the value specified by value, returning the previous value of the timer if ovalue is nonzero.

A timer value is defined by the itimerval structure:

       struct itimerval {
               struct  timeval it_interval;
               struct  timeval it_value;
       };

The value of the itimerval structure members are: as follows
itimerval Member Value  Meaning 
it_interval = 0  Disables a timer after its next expiration (Assumes it_value is nonzero). 
it_interval = nonzero  Specifies a value used in reloading it_value when the timer expires. 
it_value = 0   Disables a timer. 
it_value = nonzero  Indicates the time to the next timer expiration. 

Time values smaller than the resolution of the system clock are rounded up to this resolution.

The getitimer function provides one interval timer, defined in the <time.h> header file as ITIMER_REAL. This timer decrements in real time. When the timer expires, it delivers a SIGALARM signal.


Note
The interaction between setitimer and any of alarm, sleep, or usleep is unspecified.

Return Values
Indicates success. 
-1  An error occurred; errno is set to indicate the error. 


Previous Page | Next Page | Table of Contents | Index