GETCLOCK(3) SysV GETCLOCK(3)
NAME
getclock - get current value of system-wide clock
SYNOPSIS
#include <sys/timers.h>
int getclock (clktyp, tp)
int clktyp;
struct timespec *tp;
DESCRIPTION
The getclock function puts the current value of the clock specified by
clktyp into the location pointed to by the tp argument.
The clktyp argument is given as a symbolic constant name, as defined in
the sys/timers.h include file. Domain/OS supports the clktyp TIMEOFDAY,
which is defined in the sys/timers.h header file. This clock represents
the time-of-day clock for the system.
For this clock the values specified by getclock represent the amount of
time since the Epoch. The Epoch is referenced to 00:00:00 Coordinated
Universal Time (UCT) 1 Jan 1970.
The timespec structure, which is defined in the sys/timers.h header file,
has the following members:
unsigned long tv_sec
Elapsed time in seconds since the epoch
long tv_nsec
Elapsed time as a fraction of a second incremental to tv_sec
(expressed in nanoseconds)
DIAGNOSTICS
Upon successful completion, the getclock function returns a value of 0
(zero). Otherwise, getclock returns a value of -1 and sets errno to
indicate the error.
ERRORS
getclock fails if:
[EINVAL] The clktyp argument does not specify a known system-wide
clock.
[EIO] An error occurred when the system-wide clock specified by
the clktyp argument was accessed.
SEE ALSO
gettimer(3), setclock(3), time(3)