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 | .\" | |
5 | .\" @(#)adjtime.2 1.1 (Berkeley) %G% | |
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 | |
23 | changes the system time, as returned by | |
24 | .IR gettimeofday (2), | |
25 | moving it backward or forward | |
26 | by the number of microseconds corresponding to the timeval | |
27 | \fIdelta\fP. | |
28 | .PP | |
29 | The time is maintained by incrementing it with a machine-dependent tick | |
30 | every clock interrupt. | |
31 | If \fIdelta\fP is negative, the clock is | |
32 | slowed down by incrementing it in smaller ticks until | |
33 | the correction is made. | |
34 | If \fIdelta\fP is positive, a larger tick | |
35 | is used. | |
36 | Thus, the time is always | |
37 | a monotonically increasing function. | |
38 | A time correction from an earlier call to \fIadjtime\fP | |
39 | may not be finished when \fIadjtime\fP is called again. | |
40 | If \fIolddelta\fP is non-zero, | |
41 | then the structure pointed to will contain, upon return, the | |
42 | number of microseconds still to be corrected | |
43 | from the earlier call. | |
44 | .PP | |
45 | This call can be used in time servers that synchronize the clocks | |
46 | of computers in a local area network. | |
47 | Such time servers would slow down the clocks of some machines | |
48 | and speed up the clocks of others to bring them to the average network time. | |
49 | .PP | |
50 | The call | |
51 | .IR adjtime (2) | |
52 | is restricted to the super-user. | |
53 | .SH NOTES | |
54 | On a VAX the time is incremented | |
55 | in 10ms ticks. | |
56 | When \fIadjtime\fP is called with an argument other than zero, | |
57 | ticks of 9ms or 11ms are used until the time is corrected. | |
58 | A \fIdelta\fP of less than 1ms would have no effect. | |
59 | .SH "RETURN VALUE | |
60 | A return value of 0 indicates that the call succeeded. | |
61 | A return value of \-1 indicates that an error occurred, and in this | |
62 | case an error code is stored in the global variable \fIerrno\fP. | |
63 | .SH "ERRORS | |
64 | The following error codes may be set in \fIerrno\fP: | |
65 | .TP 15 | |
66 | [EFAULT] | |
67 | An argument points outside the process's allocated address space. | |
68 | .TP 15 | |
69 | [EPERM] | |
70 | The process's effective user ID is not that of the super-user. | |
71 | .SH "SEE ALSO" | |
72 | date(1), gettimeofday(2), timed(8), timedc(8), | |
73 | .br | |
74 | \fITSP: The Time Synchronization Protocol for UNIX 4.3BSD\fP, | |
75 | R. Gusella and S. Zatti |