improved english
[unix-history] / usr / src / lib / libc / sys / adjtime.2
CommitLineData
ab34755c
RG
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
5.\" @(#)adjtime.2 1.1 (Berkeley) %G%
6.\"
7.TH ADJTIME 2 ""
8.UC 6
9.SH NAME
10adjtime \- correct the time to allow synchronization of the system clock
11.SH SYNOPSIS
12.nf
13.ft B
14#include <sys/time.h>
15.PP
16.ft B
17adjtime(delta, olddelta)
18struct timeval *delta;
19struct timeval *olddelta;
20.fi
21.SH DESCRIPTION
22.I Adjtime
23changes the system time, as returned by
24.IR gettimeofday (2),
25moving it backward or forward
26by the number of microseconds corresponding to the timeval
27\fIdelta\fP.
28.PP
29The time is maintained by incrementing it with a machine-dependent tick
30every clock interrupt.
31If \fIdelta\fP is negative, the clock is
32slowed down by incrementing it in smaller ticks until
33the correction is made.
34If \fIdelta\fP is positive, a larger tick
35is used.
36Thus, the time is always
37a monotonically increasing function.
38A time correction from an earlier call to \fIadjtime\fP
39may not be finished when \fIadjtime\fP is called again.
40If \fIolddelta\fP is non-zero,
41then the structure pointed to will contain, upon return, the
42number of microseconds still to be corrected
43from the earlier call.
44.PP
45This call can be used in time servers that synchronize the clocks
46of computers in a local area network.
47Such time servers would slow down the clocks of some machines
48and speed up the clocks of others to bring them to the average network time.
49.PP
50The call
51.IR adjtime (2)
52is restricted to the super-user.
53.SH NOTES
54On a VAX the time is incremented
55in 10ms ticks.
56When \fIadjtime\fP is called with an argument other than zero,
57ticks of 9ms or 11ms are used until the time is corrected.
58A \fIdelta\fP of less than 1ms would have no effect.
59.SH "RETURN VALUE
60A return value of 0 indicates that the call succeeded.
61A return value of \-1 indicates that an error occurred, and in this
62case an error code is stored in the global variable \fIerrno\fP.
63.SH "ERRORS
64The following error codes may be set in \fIerrno\fP:
65.TP 15
66[EFAULT]
67An argument points outside the process's allocated address space.
68.TP 15
69[EPERM]
70The process's effective user ID is not that of the super-user.
71.SH "SEE ALSO"
72date(1), gettimeofday(2), timed(8), timedc(8),
73.br
74\fITSP: The Time Synchronization Protocol for UNIX 4.3BSD\fP,
75R. Gusella and S. Zatti