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