adjtime(2) CLIX adjtime(2)
NAME
adjtime - Corrects the time to allow synchronization of the system clock
LIBRARY
Berkeley Software Distribution Library (libbsd.a)
SYNOPSIS
#include <sys/time.h>
int adjtime(
struct timeval *delta ,
struct timeval *olddelta );
PARAMETERS
delta Points to a timeval structure that contains the time
adjustment. If delta is negative, the clock is slowed down by
incrementing it more slowly than normal until the correction is
complete. If delta is positive, a larger increment than normal
is used.
olddelta If olddelta is nonzero, the structure pointed to will contain,
upon return, the number of microseconds still to be corrected
from a previous call to adjtime().
DESCRIPTION
The adjtime() function makes small adjustments to the system time, as
returned by the gettimeofday() function. The skew used to perform the
correction is generally a fraction of one percent. Thus, the time is
always a monotonically increasing function. A time correction from an
earlier call to adjtime() may not be finished when adjtime() is called
again.
This call may be used by time servers that synchronize the clocks of
computers in a local area network (LAN). Such time servers would slow
down the clocks of some machines and speed up the clocks of others to
bring them to the average network time.
EXAMPLES
To gradually slow down the system clock by five seconds:
struct timeval adjust_tv;
adjust_tv.tv_sec = 5;
adjust_tv.tv_usec = 0;
adjtime(&adjust_tv, (struct adjtime *)0);
2/94 - Intergraph Corporation 1
adjtime(2) CLIX adjtime(2)
NOTES
The adjtime() function may be executed only by the superuser.
RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise, a value
of -1 is returned and errno is set to indicate the error.
ERRORS
The adjtime() function fails if any of the following are true:
[EFAULT] An argument points outside the process's allocated address
space.
[EPERM] The effective user ID of the calling process is not superuser.
RELATED INFORMATION
Commands: ntp(1), ntpd(1), ntpdc(1)
Functions: gettimeofday(2)
2 Intergraph Corporation - 2/94