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

NAME

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

SYNOPSIS

9       #define _BSD_SOURCE
10
11       int adjtime(const struct timeval *delta, struct timeval *olddelta);
12

DESCRIPTION

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

NOTES

40       The adjustment that adjtime() makes to the clock is carried out in such
41       a manner that the clock is always monotonically increasing.  Using adj‐
42       time()  to adjust the time prevents the problems that can be caused for
43       certain applications (e.g., make(1)) by  abrupt  positive  or  negative
44       jumps in the system time.
45
46       adjtime()  is intended to be used to make small adjustments to the sys‐
47       tem time.  Most systems impose a limit on the adjustment  that  can  be
48       specified  in  delta.   In the glibc implementation, delta must be less
49       than or equal to (INT_MAX / 1000000 - 2) and greater than or  equal  to
50       (INT_MIN / 1000000 + 2) (respectively 2145 and -2145 seconds on x86).
51

RETURN VALUE

53       On success, adjtime() returns 0.  On failure, -1 is returned, and errno
54       is set to indicate the error.
55

ERRORS

57       EINVAL The adjustment in delta is outside the permitted range.
58
59       EPERM  The caller does not have  sufficient  privilege  to  adjust  the
60              time.  Under Linux the CAP_SYS_TIME capability is required.
61

CONFORMING TO

63       4.3BSD, System V.
64

BUGS

66       Currently,  if  delta  is specified as NULL, no valid information about
67       the outstanding clock adjustment is returned  in  olddelta.   (In  this
68       circumstance, adjtime() should return the outstanding clock adjustment,
69       without changing it.)  This is the result of a kernel limitation.
70

SEE ALSO

72       adjtimex(2), gettimeofday(2), feature_test_macros(7), time(7)
73
74
75
76Linux 2.6.16                      2006-05-01                        ADJTIME(3)
Impressum