1ADJTIME(3)                 Linux Programmer's Manual                ADJTIME(3)
2
3
4

NAME

6       adjtime - correct the time to synchronize the system clock
7

SYNOPSIS

9       int adjtime(const struct timeval *delta, struct timeval *olddelta);
10
11   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
12
13       adjtime(): _BSD_SOURCE
14

DESCRIPTION

16       The  adjtime() function gradually adjusts the system clock (as returned
17       by gettimeofday(2)).  The amount of time by which the clock  is  to  be
18       adjusted  is  specified  in  the  structure  pointed to by delta.  This
19       structure has the following form:
20
21           struct timeval {
22               time_t      tv_sec;     /* seconds */
23               suseconds_t tv_usec;    /* microseconds */
24           };
25
26       If the adjustment in delta  is  positive,  then  the  system  clock  is
27       speeded  up by some small percentage (i.e., by adding a small amount of
28       time to the clock value in each second) until the adjustment  has  been
29       completed.   If  the adjustment in delta is negative, then the clock is
30       slowed down in a similar fashion.
31
32       If a clock adjustment from an earlier  adjtime()  call  is  already  in
33       progress  at  the time of a later adjtime() call, and delta is not NULL
34       for the later call, then the earlier adjustment  is  stopped,  but  any
35       already completed part of that adjustment is not undone.
36
37       If  olddelta  is not NULL, then the buffer that it points to is used to
38       return the amount of time remaining from any previous  adjustment  that
39       has not yet been completed.
40

RETURN VALUE

42       On success, adjtime() returns 0.  On failure, -1 is returned, and errno
43       is set to indicate the error.
44

ERRORS

46       EINVAL The adjustment in delta is outside the permitted range.
47
48       EPERM  The caller does not have  sufficient  privilege  to  adjust  the
49              time.  Under Linux the CAP_SYS_TIME capability is required.
50

CONFORMING TO

52       4.3BSD, System V.
53

NOTES

55       The adjustment that adjtime() makes to the clock is carried out in such
56       a manner that the clock is always monotonically increasing.  Using adj‐
57       time()  to adjust the time prevents the problems that can be caused for
58       certain applications (e.g., make(1)) by  abrupt  positive  or  negative
59       jumps in the system time.
60
61       adjtime()  is intended to be used to make small adjustments to the sys‐
62       tem time.  Most systems impose a limit on the adjustment  that  can  be
63       specified  in  delta.   In the glibc implementation, delta must be less
64       than or equal to (INT_MAX / 1000000 - 2) and greater than or  equal  to
65       (INT_MIN / 1000000 + 2) (respectively 2145 and -2145 seconds on i386).
66

BUGS

68       A  longstanding bug meant that if delta was specified as NULL, no valid
69       information about the outstanding clock adjustment was returned in old‐
70       delta.   (In this circumstance, adjtime() should return the outstanding
71       clock adjustment, without changing it.)  This bug is fixed  on  systems
72       with glibc 2.8 or later and Linux kernel 2.6.26 or later.
73

SEE ALSO

75       adjtimex(2), gettimeofday(2), time(7)
76

COLOPHON

78       This  page  is  part of release 3.25 of the Linux man-pages project.  A
79       description of the project, and information about reporting  bugs,  can
80       be found at http://www.kernel.org/doc/man-pages/.
81
82
83
84Linux                             2008-06-22                        ADJTIME(3)
Impressum