1 .\" Copyright (c) 1995 Michael Chastain (mec@shell.portal.com), 15 April 1995.
3 .\" %%%LICENSE_START(GPLv2+_doc_full)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 .\" GNU General Public License for more details.
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, see
21 .\" <http://www.gnu.org/licenses/>.
24 .\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
25 .\" Modified 1997-07-30 by Paul Slootman <paul@wurtel.demon.nl>
26 .\" Modified 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
28 .\" FIXME 2.6.29 added ADJ_SETOFFSET
30 .TH ADJTIMEX 2 2004-05-27 "Linux" "Linux Programmer's Manual"
32 adjtimex \- tune kernel clock
34 .B #include <sys/timex.h>
36 .BI "int adjtimex(struct timex *" "buf" );
38 Linux uses David L. Mills' clock adjustment algorithm (see RFC\ 1305).
41 reads and optionally sets adjustment parameters for this algorithm.
42 It takes a pointer to a
44 structure, updates kernel parameters from field values,
45 and returns the same structure with current kernel values.
46 This structure is declared as follows:
51 int modes; /* mode selector */
52 long offset; /* time offset (usec) */
53 long freq; /* frequency offset (scaled ppm) */
54 .\" FIXME -- what is the scaling unit? 2^16 ?
55 long maxerror; /* maximum error (usec) */
56 long esterror; /* estimated error (usec) */
57 int status; /* clock command/status */
58 long constant; /* pll time constant */
59 long precision; /* clock precision (usec) (read-only) */
60 long tolerance; /* clock frequency tolerance (ppm)
62 struct timeval time; /* current time (read-only) */
63 long tick; /* usecs between clock ticks */
70 field determines which parameters, if any, to set.
73 combination of zero or more of the following bits:
77 #define ADJ_OFFSET 0x0001 /* time offset */
78 #define ADJ_FREQUENCY 0x0002 /* frequency offset */
79 #define ADJ_MAXERROR 0x0004 /* maximum time error */
80 #define ADJ_ESTERROR 0x0008 /* estimated time error */
81 #define ADJ_STATUS 0x0010 /* clock status */
82 #define ADJ_TIMECONST 0x0020 /* pll time constant */
83 #define ADJ_TICK 0x4000 /* tick value */
84 #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime() */
88 Ordinary users are restricted to a zero value for
90 Only the superuser may set any parameters.
96 returns the clock state:
100 #define TIME_OK 0 /* clock synchronized */
101 #define TIME_INS 1 /* insert leap second */
102 #define TIME_DEL 2 /* delete leap second */
103 #define TIME_OOP 3 /* leap second in progress */
104 #define TIME_WAIT 4 /* leap second has occurred */
105 #define TIME_BAD 5 /* clock not synchronized */
117 does not point to writable memory.
120 An attempt is made to set
122 to a value outside the range \-131071 to +131071,
125 to a value other than those listed above,
128 to a value outside the range
134 is the system timer interrupt frequency.
138 is nonzero and the caller does not have sufficient privilege.
141 capability is required.
144 is Linux-specific and should not be used in programs
145 intended to be portable.
148 for a more portable, but less flexible,
149 method of adjusting the system clock.
151 .BR settimeofday (2),
153 .BR capabilities (7),