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

NAME

6       adjtimex - tune kernel clock
7

SYNOPSIS

9       #include <sys/timex.h>
10
11       int adjtimex(struct timex *buf);
12

DESCRIPTION

14       Linux  uses  David L. Mills' clock adjustment algorithm (see RFC 1305).
15       The system call adjtimex() reads and optionally sets adjustment parame‐
16       ters  for  this  algorithm.   It  takes a pointer to a timex structure,
17       updates kernel parameters from  field  values,  and  returns  the  same
18       structure  with  current  kernel values.  This structure is declared as
19       follows:
20
21           struct timex {
22               int modes;           /* mode selector */
23               long offset;         /* time offset (usec) */
24               long freq;           /* frequency offset (scaled ppm) */
25               long maxerror;       /* maximum error (usec) */
26               long esterror;       /* estimated error (usec) */
27               int status;          /* clock command/status */
28               long constant;       /* pll time constant */
29               long precision;      /* clock precision (usec) (read-only) */
30               long tolerance;      /* clock frequency tolerance (ppm)
31                                       (read-only) */
32               struct timeval time; /* current time (read-only) */
33               long tick;           /* usecs between clock ticks */
34           };
35
36       The modes field determines which parameters, if any, to  set.   It  may
37       contain a bitwise-or combination of zero or more of the following bits:
38
39           #define ADJ_OFFSET            0x0001 /* time offset */
40           #define ADJ_FREQUENCY         0x0002 /* frequency offset */
41           #define ADJ_MAXERROR          0x0004 /* maximum time error */
42           #define ADJ_ESTERROR          0x0008 /* estimated time error */
43           #define ADJ_STATUS            0x0010 /* clock status */
44           #define ADJ_TIMECONST         0x0020 /* pll time constant */
45           #define ADJ_TICK              0x4000 /* tick value */
46           #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime() */
47
48       Ordinary users are restricted to a zero value for mode.  Only the supe‐
49       ruser may set any parameters.
50

RETURN VALUE

52       On success, adjtimex() returns the clock state:
53
54           #define TIME_OK   0 /* clock synchronized */
55           #define TIME_INS  1 /* insert leap second */
56           #define TIME_DEL  2 /* delete leap second */
57           #define TIME_OOP  3 /* leap second in progress */
58           #define TIME_WAIT 4 /* leap second has occurred */
59           #define TIME_BAD  5 /* clock not synchronized */
60
61       On failure, adjtimex() returns -1 and sets errno.
62

ERRORS

64       EFAULT buf does not point to writable memory.
65
66       EINVAL An attempt is made to set buf.offset  to  a  value  outside  the
67              range  -131071 to +131071, or to set buf.status to a value other
68              than those listed above, or to set buf.tick to a  value  outside
69              the  range 900000/HZ to 1100000/HZ, where HZ is the system timer
70              interrupt frequency.
71
72       EPERM  buf.mode is non-zero and the caller  does  not  have  sufficient
73              privilege.  Under Linux the CAP_SYS_TIME capability is required.
74

CONFORMING TO

76       adjtimex()  is  Linux-specific  and  should  not  be  used  in programs
77       intended to be portable.  See adjtime(3) for a more portable, but  less
78       flexible, method of adjusting the system clock.
79

SEE ALSO

81       settimeofday(2), adjtime(3), capabilities(7), time(7)
82

COLOPHON

84       This  page  is  part of release 3.22 of the Linux man-pages project.  A
85       description of the project, and information about reporting  bugs,  can
86       be found at http://www.kernel.org/doc/man-pages/.
87
88
89
90Linux                             2004-05-27                       ADJTIMEX(2)
Impressum