ADJTIME(2) COMMAND REFERENCE ADJTIME(2)
NAME
adjtime - correct the time to allow synchronization of the
system clock
SYNOPSIS
#include <sys/time.h>
adjtime(delta, mode)
struct timeval *delta;
int mode;
DESCRIPTION
The program adjtime changes the system time, as returned by
gettimeofday(2), in the way specified by the argument mode.
If mode is T_ADJ then adjtime moves the time back or forward
by a number of milliseconds corresponding to the timeval
delta while keeping the monotonicity of the function. If
mode is T_SET then delta milliseconds are added algebraicly
to the time.
This call can be used in timeservers that synchronize the
clocks of computers in a network to keep an accurate network
time.
Only the superuser can call adjtime. The time is normally
incremented by a 20ms tick. If T_ADJ is passed and delta is
negative, the clock is incremented with a smaller tick for
the time necessary to correct the error. When delta is
positive a larger tick is used. This way, the clock is
always a monotonic function. With respect to this, adjtime
with mode set to T_SET, should be used carefully and only at
boot time before any users can log on.
The T_SET mode has been introduced to make, at the process
level, the operation of adding a value to the time an atomic
one.
DIAGNOSTICS
The program adjtime may set the following errors in errno:
[EINVAL]
mode is not valid.
[EFAULT]
An argument references invalid memory.
[EPERM]
The caller is not the superuser.
RETURN VALUE
Upon successful completion, a value of 0 is returned.
Otherwise, a value of -1 is returned and errno is set to
Printed 4/6/89 1
ADJTIME(2) COMMAND REFERENCE ADJTIME(2)
indicate the error.
SEE ALSO
gettimeofday(2)
Printed 4/6/89 2
%%index%%
na:312,128;
sy:440,857;
de:1297,1679;
di:2976,437;
rv:3413,254;4051,26;
se:4077,174;
%%index%%000000000118