HP-UX Reference (11i v2 07/12) - 2 System Calls (vol 5)

t
timers(2) timers(2)
NAME
timers: timer_create(), timer_delete(), timer_settime(), timer_gettime(), timer_getoverrun() - 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_settime(
timer_t timerid,
int flags,
const struct itimerspec *value,
struct itimerspec *ovalue
);
int timer_gettime(
timer_t timerid,
struct itimerspec *value
);
int timer_getoverrun(
timer_t timerid
);
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 calling
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.
474 Hewlett-Packard Company 1 HP-UX 11i Version 2: December 2007 Update