Commit | Line | Data |
---|---|---|
931b8415 | 1 | .\" Copyright (c) 1980, 1991 Regents of the University of California. |
d4a07fef | 2 | .\" All rights reserved. |
ab34755c | 3 | .\" |
91cff1e1 | 4 | .\" %sccs.include.redist.man% |
d4a07fef | 5 | .\" |
931b8415 | 6 | .\" @(#)adjtime.2 1.7 (Berkeley) %G% |
ab34755c | 7 | .\" |
931b8415 CL |
8 | .Dd |
9 | .Dt ADJTIME 2 | |
10 | .Os BSD 4.3 | |
11 | .Sh NAME | |
12 | .Nm adjtime | |
13 | .Nd "correct the time to allow synchronization of the system clock" | |
14 | .Sh SYNOPSIS | |
15 | .Fd #include <sys/time.h> | |
16 | .Ft int | |
17 | .Fn adjtime "struct timeval *delta" "struct timeval *olddelta" | |
18 | .Sh DESCRIPTION | |
19 | .Fn Adjtime | |
9d26ec35 | 20 | makes small adjustments to the system time, as returned by |
931b8415 | 21 | .Xr gettimeofday 2 , |
9d26ec35 | 22 | advancing or retarding it |
09cfce6f | 23 | by the time specified by the timeval |
931b8415 CL |
24 | .Fa delta . |
25 | If | |
26 | .Fa delta | |
27 | is negative, the clock is | |
9d26ec35 MK |
28 | slowed down by incrementing it more slowly than normal until |
29 | the correction is complete. | |
931b8415 CL |
30 | If |
31 | .Fa delta | |
32 | is positive, a larger increment than normal | |
ab34755c | 33 | is used. |
9d26ec35 | 34 | The skew used to perform the correction is generally a fraction of one percent. |
ab34755c RG |
35 | Thus, the time is always |
36 | a monotonically increasing function. | |
931b8415 CL |
37 | A time correction from an earlier call to |
38 | .Fn adjtime | |
39 | may not be finished when | |
40 | .Fn adjtime | |
41 | is called again. | |
42 | If | |
43 | .Fa olddelta | |
44 | is non-nil, | |
45 | the structure pointed to will contain, upon return, the | |
ab34755c RG |
46 | number of microseconds still to be corrected |
47 | from the earlier call. | |
931b8415 | 48 | .Pp |
9d26ec35 | 49 | This call may be used by time servers that synchronize the clocks |
ab34755c RG |
50 | of computers in a local area network. |
51 | Such time servers would slow down the clocks of some machines | |
52 | and speed up the clocks of others to bring them to the average network time. | |
931b8415 | 53 | .Pp |
ab34755c | 54 | The call |
931b8415 | 55 | .Fn adjtime |
ab34755c | 56 | is restricted to the super-user. |
931b8415 | 57 | .Sh RETURN VALUES |
ab34755c | 58 | A return value of 0 indicates that the call succeeded. |
931b8415 CL |
59 | A return value of -1 indicates that an error occurred, and in this |
60 | case an error code is stored in the global variable | |
61 | .Va errno . | |
62 | .Sh ERRORS | |
63 | .Fn Adjtime | |
64 | will fail if: | |
65 | .Bl -tag -width Er | |
66 | .It Bq Er EFAULT | |
ab34755c | 67 | An argument points outside the process's allocated address space. |
931b8415 | 68 | .It Bq Er EPERM |
ab34755c | 69 | The process's effective user ID is not that of the super-user. |
931b8415 CL |
70 | .El |
71 | .Sh SEE ALSO | |
72 | .Xr date 1 , | |
73 | .Xr gettimeofday 2 , | |
74 | .Xr timed 8 , | |
75 | .Xr timedc 8 , | |
76 | .Rs | |
77 | .%T "TSP: The Time Synchronization Protocol for UNIX 4.3BSD" | |
78 | .%A R. Gusella | |
79 | .%A S. Zatti | |
80 | .Re | |
81 | .Sh HISTORY | |
82 | The | |
83 | .Nm | |
84 | function call appeared in | |
85 | .Bx 4.3 . |