timers.2 (2010 09)
t
timers(2) timers(2)
NAME
timers: timer_create(), timer_delete(), timer_getoverrun(), timer_gettime(), timer_settime() - timer opera-
tions
SYNOPSIS
#include <time.h>
int timer_create(
clockid_t clock_id,
struct sigevent *evp,
timer_t *timerid
);
int timer_delete(
timer_t timerid
);
int timer_getoverrun(
timer_t timerid
);
int timer_gettime(
timer_t timerid,
struct itimerspec *value
);
int timer_settime(
timer_t timerid,
int flags,
const struct itimerspec *value,
struct itimerspec *ovalue
);
DESCRIPTION
timer_create()
The timer_create() function creates a per-process timer using the specified clock, clock_id , as the
timing base. The
timer_create()
function returns, in the location referenced by timerid, a timer ID
of type timer_t used to identify the timer in timer requests. This timer ID will be unique within the cal-
ling process until the timer is deleted. The particular clock, clock_id , is defined in
<time.h>. The
timer whose ID is returned will be in a disarmed state upon return from
timer_create()
.
The evp argument, if non-NULL, points to a sigevent structure. If the sigev_notify member of evp is
SIGEV_SIGNAL, then the structure should also specify the signal number to be sent to the process on
timer expiration. The signal to be sent is specified in the sigev_signo field of evp. If the sigev_notify
member of evp is
SIGEV_NONE, no notification is sent. If evp is NULL, then a default signal is sent to
the process. The defaults for the clocks CLOCK_REALTIME, CLOCK_VIRTUAL
, and CLOCK_PROFILE
are SIGALRM, SIGVTALRM, and SIGPROF.
Per-process timers are not inherited by a child process across a
fork() and are disarmed and deleted by
an exec().
timer_delete()
The
timer_delete() function deletes the specified timer, timerid, previously created by the
timer_create() function. If the timer is armed when timer_delete()
is called, the behavior is as
if the timer is automatically disarmed before removal. Any pending notifications from the timer remain.
timer_settime()
The
timer_settime() function sets the time until the next expiration of the timer specified by timerid
from the it_value member of the value argument and arms the timer if the it_value member of value is
non-zero. If the specified timer was already armed when timer_settime() is called, this call resets
the time until next expiration to the value specified. If the it_value member of value is zero, the timer is
disarmed. Any pending notifications from the timer remain.
If the flag
TIMER_ABSTIME is not set in the argument flags, timer_settime() behaves as if the time
until next expiration is set equal to the interval specified by the it_value member of value. That is, the
timer will expire in it_value nanoseconds from when the call is made.
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1