ALARM(2) — HP-UX
NAME
alarm − set a process’s alarm clock
SYNOPSIS
unsigned long alarm (sec)
unsigned long sec;
DESCRIPTION
Alarm instructs the alarm clock of the calling process to send the signal SIGALRM to the calling process after the number of real time seconds specified by sec have elapsed; see signal(2). Specific implementations may place limitations of the maximum alarm time supported. The constant MAX_ALARM defined in <sys/param.h> specifies the implementation specific maximum. Whenever sec is greater that this maximum, it is silently rounded down to it. On all implementations, MAX_ALARM is guaranteed to be at least 31 days (in seconds).
Alarm requests are not stacked; successive calls reset the alarm clock of the calling process.
If sec is 0, any previously made alarm request is canceled.
Alarms are not inherited by a child process across a fork, but are inherited across an exec.
On systems which support the getitimer(2) and setitimer, the timer mechanism used by alarm is the same as that used by ITIMER_REAL. Thus successive calls to alarm, getitimer, and setitimer will set and return the state of a single timer.
RETURN VALUE
Alarm returns the amount of time previously remaining in the alarm clock of the calling process.
SEE ALSO
sleep(1), getitimer(2), pause(2), signal(2), sleep(3C).
BUGS
In some implementations, error bounds for alarm are -1, +0 seconds (for the posting of the alarm, not the restart of the process). Thus a delay of 1 second can return immediately. The setitimer routine can be used to create a more precise delay.
Hewlett-Packard Company — Version B.1, April 12, 1993