add note about finding the end of memory
[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.\"
09cfce6f 5.\" @(#)adjtime.2 1.3 (Berkeley) %G%
ab34755c
RG
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
9d26ec35 23makes small adjustments to the system time, as returned by
ab34755c 24.IR gettimeofday (2),
9d26ec35 25advancing or retarding it
09cfce6f 26by the time specified by the timeval
ab34755c 27\fIdelta\fP.
ab34755c 28If \fIdelta\fP is negative, the clock is
9d26ec35
MK
29slowed down by incrementing it more slowly than normal until
30the correction is complete.
31If \fIdelta\fP is positive, a larger increment than normal
ab34755c 32is used.
9d26ec35 33The skew used to perform the correction is generally a fraction of one percent.
ab34755c
RG
34Thus, the time is always
35a monotonically increasing function.
36A time correction from an earlier call to \fIadjtime\fP
37may not be finished when \fIadjtime\fP is called again.
38If \fIolddelta\fP is non-zero,
39then the structure pointed to will contain, upon return, the
40number of microseconds still to be corrected
41from the earlier call.
42.PP
9d26ec35 43This call may be used by time servers that synchronize the clocks
ab34755c
RG
44of computers in a local area network.
45Such time servers would slow down the clocks of some machines
46and speed up the clocks of others to bring them to the average network time.
47.PP
48The call
49.IR adjtime (2)
50is restricted to the super-user.
ab34755c
RG
51.SH "RETURN VALUE
52A return value of 0 indicates that the call succeeded.
53A return value of \-1 indicates that an error occurred, and in this
54case an error code is stored in the global variable \fIerrno\fP.
55.SH "ERRORS
56The following error codes may be set in \fIerrno\fP:
57.TP 15
58[EFAULT]
59An argument points outside the process's allocated address space.
60.TP 15
61[EPERM]
62The process's effective user ID is not that of the super-user.
63.SH "SEE ALSO"
64date(1), gettimeofday(2), timed(8), timedc(8),
65.br
66\fITSP: The Time Synchronization Protocol for UNIX 4.3BSD\fP,
67R. Gusella and S. Zatti