blob: 2e688880a8b2d71e905091161efa63a32601d53e [file] [log] [blame]
Rich Felkerf5ba2bc2011-03-18 21:52:26 -04001#ifndef _SYS_TIMEX_H
2#define _SYS_TIMEX_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
Rich Felker662da622012-09-16 22:26:23 -04008#define __NEED_clockid_t
9
10#include <bits/alltypes.h>
11
Rich Felkerf5ba2bc2011-03-18 21:52:26 -040012#include <sys/time.h>
13
Rich Felkerfd9e01e2011-09-20 20:02:48 -040014struct ntptimeval {
Rich Felkerf5ba2bc2011-03-18 21:52:26 -040015 struct timeval time;
16 long maxerror, esterror;
17};
18
19struct timex {
20 unsigned modes;
21 long offset, freq, maxerror, esterror;
22 int status;
23 long constant, precision, tolerance;
24 struct timeval time;
25 long tick, ppsfreq, jitter;
26 int shift;
27 long stabil, jitcnt, calcnt, errcnt, stbcnt;
28 int tai;
29 int __padding[11];
30};
31
32#define ADJ_OFFSET 0x0001
33#define ADJ_FREQUENCY 0x0002
34#define ADJ_MAXERROR 0x0004
35#define ADJ_ESTERROR 0x0008
36#define ADJ_STATUS 0x0010
37#define ADJ_TIMECONST 0x0020
38#define ADJ_TAI 0x0080
Szabolcs Nagyd4c04d12013-03-23 19:51:34 +000039#define ADJ_SETOFFSET 0x0100
Rich Felkerf5ba2bc2011-03-18 21:52:26 -040040#define ADJ_MICRO 0x1000
41#define ADJ_NANO 0x2000
42#define ADJ_TICK 0x4000
43#define ADJ_OFFSET_SINGLESHOT 0x8001
44#define ADJ_OFFSET_SS_READ 0xa001
45
46#define MOD_OFFSET ADJ_OFFSET
47#define MOD_FREQUENCY ADJ_FREQUENCY
48#define MOD_MAXERROR ADJ_MAXERROR
49#define MOD_ESTERROR ADJ_ESTERROR
50#define MOD_STATUS ADJ_STATUS
51#define MOD_TIMECONST ADJ_TIMECONST
52#define MOD_CLKB ADJ_TICK
53#define MOD_CLKA ADJ_OFFSET_SINGLESHOT
Szabolcs Nagy200f96c2013-01-12 19:14:34 +010054#define MOD_TAI ADJ_TAI
Rich Felkerf5ba2bc2011-03-18 21:52:26 -040055#define MOD_MICRO ADJ_MICRO
56#define MOD_NANO ADJ_NANO
57
58#define STA_PLL 0x0001
59#define STA_PPSFREQ 0x0002
60#define STA_PPSTIME 0x0004
61#define STA_FLL 0x0008
62
63#define STA_INS 0x0010
64#define STA_DEL 0x0020
65#define STA_UNSYNC 0x0040
66#define STA_FREQHOLD 0x0080
67
68#define STA_PPSSIGNAL 0x0100
69#define STA_PPSJITTER 0x0200
70#define STA_PPSWANDER 0x0400
71#define STA_PPSERROR 0x0800
72
73#define STA_CLOCKERR 0x1000
74#define STA_NANO 0x2000
75#define STA_MODE 0x4000
76#define STA_CLK 0x8000
77
78#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
Szabolcs Nagy200f96c2013-01-12 19:14:34 +010079 STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
Rich Felkerf5ba2bc2011-03-18 21:52:26 -040080
81#define TIME_OK 0
82#define TIME_INS 1
83#define TIME_DEL 2
84#define TIME_OOP 3
85#define TIME_WAIT 4
86#define TIME_ERROR 5
87#define TIME_BAD TIME_ERROR
88
89#define MAXTC 6
90
91int adjtimex(struct timex *);
Rich Felker662da622012-09-16 22:26:23 -040092int clock_adjtime(clockid_t, struct timex *);
Rich Felkerf5ba2bc2011-03-18 21:52:26 -040093
94#ifdef __cplusplus
95}
96#endif
97
98#endif