SETCLOCK(3) SysV SETCLOCK(3)
NAME
setclock - Set value of system-wide clock
SYNOPSIS
#include <sys/timers.h>
int setclock (clktyp tp)
int clktyp,
struct timespec *tp;
DESCRIPTION
The setclock function sets a time value, tp for the specified system-wide
clock, clktyp.
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 setclock 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)
The calling process must have appropriate privileges to set the TIMEOFDAY
clock.
setclock has no effect on enabled per-process timers.
DIAGNOSTICS
Upon successful completion, the setclock() function returns a value of 0
(zero). Otherwise, a value of -1 is returned and errno is set to
indicate the error.
ERRORS
setclock fails if:
[EINVAL] The clktyp argument does not specify a known system-wide
clock, the information pointed to by the tp argument is
outside the permissible range for the clock specified by
the clktyp argument, or a nanosecond value less than zero
or greater than or equal to 1000 million is specified by
the information pointed to by the tp argument.
[EIO] An error occurred while accessing the clock specified by
the clktyp argument.
[EPERM] The requesting process does not have the appropriate
privilege to set the clock specified by the clktyp
argument.
SEE ALSO
getclock(3), gettimer(3), time(2), <sys/timers>