1 diff -urN chrony-1.31.org/chrony_timex.h chrony-1.31/chrony_timex.h
2 --- chrony-1.31.org/chrony_timex.h 2014-09-10 17:00:54.000000000 +0200
3 +++ chrony-1.31/chrony_timex.h 1970-01-01 01:00:00.000000000 +0100
5 -/* Taken from /usr/include/linux/timex.h. Avoids the need to
6 - * include kernel header files. */
8 -#ifndef CHRONY_TIMEX_H
9 -#define CHRONY_TIMEX_H
11 -#include <sys/time.h>
14 - unsigned int modes; /* mode selector */
15 - long offset; /* time offset (usec) */
16 - long freq; /* frequency offset (scaled ppm) */
17 - long maxerror; /* maximum error (usec) */
18 - long esterror; /* estimated error (usec) */
19 - int status; /* clock command/status */
20 - long constant; /* pll time constant */
21 - long precision; /* clock precision (usec) (read only) */
22 - long tolerance; /* clock frequency tolerance (ppm)
25 - struct timeval time; /* (read only) */
26 - long tick; /* (modified) usecs between clock ticks */
28 - long ppsfreq; /* pps frequency (scaled ppm) (ro) */
29 - long jitter; /* pps jitter (us) (ro) */
30 - int shift; /* interval duration (s) (shift) (ro) */
31 - long stabil; /* pps stability (scaled ppm) (ro) */
32 - long jitcnt; /* jitter limit exceeded (ro) */
33 - long calcnt; /* calibration intervals (ro) */
34 - long errcnt; /* calibration errors (ro) */
35 - long stbcnt; /* stability limit exceeded (ro) */
37 - int :32; int :32; int :32; int :32;
38 - int :32; int :32; int :32; int :32;
39 - int :32; int :32; int :32; int :32;
42 -#define ADJ_OFFSET 0x0001 /* time offset */
43 -#define ADJ_FREQUENCY 0x0002 /* frequency offset */
44 -#define ADJ_MAXERROR 0x0004 /* maximum time error */
45 -#define ADJ_STATUS 0x0010 /* clock status */
46 -#define ADJ_TIMECONST 0x0020 /* pll time constant */
47 -#define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */
48 -#define ADJ_NANO 0x2000 /* select nanosecond resolution */
49 -#define ADJ_TICK 0x4000 /* tick value */
50 -#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
51 -#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
53 -#define SHIFT_USEC 16 /* frequency offset scale (shift) */
55 -#define STA_PLL 0x0001 /* enable PLL updates (rw) */
56 -#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */
57 -#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */
58 -#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */
60 -#define STA_INS 0x0010 /* insert leap (rw) */
61 -#define STA_DEL 0x0020 /* delete leap (rw) */
62 -#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */
63 -#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */
65 -#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */
66 -#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */
67 -#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */
68 -#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */
70 -#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */
71 -#define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */
73 -/* This doesn't seem to be in any include files !! */
75 -extern int adjtimex(struct timex *);
77 -#endif /* CHRONY_TIMEX_H */
78 diff -urN chrony-1.31.org/wrap_adjtimex.c chrony-1.31/wrap_adjtimex.c
79 --- chrony-1.31.org/wrap_adjtimex.c 2014-09-10 17:00:54.000000000 +0200
80 +++ chrony-1.31/wrap_adjtimex.c 2015-02-19 18:14:48.994437746 +0100
83 =======================================================================
85 - This is a wrapper around the Linux adjtimex system call. It isolates the
86 - inclusion of <linux/adjtimex.h> from the need to include other header files,
87 - many of which conflict with those in <linux/...> on some recent distributions
88 - (as of Jul 2000) using kernels around 2.2.16 onwards.
89 + This is a wrapper around the Linux adjtimex system call.
95 -#include "chrony_timex.h"
96 #include "wrap_adjtimex.h"
98 +#include <sys/timex.h>
100 +/* Definitions used if missing in the system headers */
102 +#define ADJ_TAI 0x0080 /* set TAI offset */
104 +#ifndef ADJ_SETOFFSET
105 +#define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */
108 +#define ADJ_NANO 0x2000 /* select nanosecond resolution */
110 +#ifndef ADJ_OFFSET_SS_READ
111 +#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
114 +/* Frequency offset scale (shift) */
115 +#define SHIFT_USEC 16
117 static int status = 0;