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.26 added ADJ_TAI
29 .\" commit 153b5d054ac2d98ea0d86504884326b6777f683d
30 .\" FIXME 2.6.26 added ADJ_MICOR and ADJ_NANO
31 .\" commit eea83d896e318bda54be2d2770d2c5d6668d11db
32 .\" Author: Roman Zippel <zippel@linux-m68k.org>
33 .\" FIXME 2.6.39 added ADJ_SETOFFSET
34 .\" commit 094aa1881fdc1b8889b442eb3511b31f3ec2b762
35 .\" Author: Richard Cochran <richardcochran@gmail.com>
37 .TH ADJTIMEX 2 2013-08-07 "Linux" "Linux Programmer's Manual"
39 adjtimex \- tune kernel clock
41 .B #include <sys/timex.h>
43 .BI "int adjtimex(struct timex *" "buf" );
45 Linux uses David L. Mills' clock adjustment algorithm (see RFC\ 1305).
48 reads and optionally sets adjustment parameters for this algorithm.
49 It takes a pointer to a
51 structure, updates kernel parameters from field values,
52 and returns the same structure with current kernel values.
53 This structure is declared as follows:
58 int modes; /* mode selector */
59 long offset; /* time offset (usec) */
60 long freq; /* frequency offset (scaled ppm) */
61 .\" FIXME -- what is the scaling unit? 2^16 ?
62 long maxerror; /* maximum error (usec) */
63 long esterror; /* estimated error (usec) */
64 int status; /* clock command/status */
65 long constant; /* pll time constant */
66 long precision; /* clock precision (usec) (read-only) */
67 long tolerance; /* clock frequency tolerance (ppm)
69 struct timeval time; /* current time (read-only) */
70 long tick; /* usecs between clock ticks */
77 field determines which parameters, if any, to set.
80 combination of zero or more of the following bits:
84 #define ADJ_OFFSET 0x0001 /* time offset */
85 #define ADJ_FREQUENCY 0x0002 /* frequency offset */
86 #define ADJ_MAXERROR 0x0004 /* maximum time error */
87 #define ADJ_ESTERROR 0x0008 /* estimated time error */
88 #define ADJ_STATUS 0x0010 /* clock status */
89 #define ADJ_TIMECONST 0x0020 /* pll time constant */
90 #define ADJ_TICK 0x4000 /* tick value */
91 #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime() */
95 Ordinary users are restricted to a zero value for
97 Only the superuser may set any parameters.
103 returns the clock state:
107 #define TIME_OK 0 /* clock synchronized */
108 #define TIME_INS 1 /* insert leap second */
109 #define TIME_DEL 2 /* delete leap second */
110 #define TIME_OOP 3 /* leap second in progress */
111 #define TIME_WAIT 4 /* leap second has occurred */
112 #define TIME_BAD 5 /* clock not synchronized */
124 does not point to writable memory.
127 An attempt is made to set
129 to a value outside the range \-131071 to +131071,
132 to a value other than those listed above,
135 to a value outside the range
141 is the system timer interrupt frequency.
145 is nonzero and the caller does not have sufficient privilege.
148 capability is required.
151 is Linux-specific and should not be used in programs
152 intended to be portable.
155 for a more portable, but less flexible,
156 method of adjusting the system clock.
158 .BR settimeofday (2),
160 .BR capabilities (7),
164 This page is part of release 3.67 of the Linux
167 A description of the project,
168 information about reporting bugs,
169 and the latest version of this page,
171 \%http://www.kernel.org/doc/man\-pages/.