1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
use super::time::*;
use super::types::*;
pub const NTP_API: i32 = 4;
#[repr(C)]
pub struct timex_t {
pub modes: u32,
pub offset: isize,
pub freq: isize,
pub maxerror: isize,
pub esterror: isize,
pub status: i32,
pub constant: isize,
pub precision: isize,
pub tolerance: isize,
pub time: timeval_t,
pub tick: isize,
pub ppsfreq: isize,
pub jitter: isize,
pub shift: i32,
pub stabil: isize,
pub jitcnt: isize,
pub calcnt: isize,
pub errcnt: isize,
pub stbcnt: isize,
pub tai: i32,
pad: [i32; 11],
}
#[repr(C)]
pub struct kernel_timex_timeval_t {
pub tv_sec: time64_t,
pub tv_usec: i64,
}
#[repr(C)]
pub struct kernel_timex_t {
pub modes: u32,
pad1: i32,
pub offset: i64,
pub freq: i64,
pub maxerror: i64,
pub esterror: i64,
pub status: i32,
pad2: i32,
pub constant: i64,
pub precision: i64,
pub tolerance: i64,
pub time: kernel_timex_timeval_t,
pub tick: i64,
pub ppsfreq: i64,
pub jitter: i64,
pub shift: i32,
pad3: i32,
pub stabil: i64,
pub jitcnt: i64,
pub calcnt: i64,
pub errcnt: i64,
pub stbcnt: i64,
pub tail: i32,
pad4: [i32; 11],
}
pub const ADJ_OFFSET: i32 = 0x0001;
pub const ADJ_FREQUENCY: i32 = 0x0002;
pub const ADJ_MAXERROR: i32 = 0x0004;
pub const ADJ_ESTERROR: i32 = 0x0008;
pub const ADJ_STATUS: i32 = 0x0010;
pub const ADJ_TIMECONST: i32 = 0x0020;
pub const ADJ_TAI: i32 = 0x0080;
pub const ADJ_SETOFFSET: i32 = 0x0100;
pub const ADJ_MICRO: i32 = 0x1000;
pub const ADJ_NANO: i32 = 0x2000;
pub const ADJ_TICK: i32 = 0x4000;
pub const ADJ_OFFSET_SINGLESHOT: i32 = 0x8001;
pub const ADJ_OFFSET_SS_READ: i32 = 0xa001;
pub const MOD_OFFSET: i32 = ADJ_OFFSET;
pub const MOD_FREQUENCY: i32 = ADJ_FREQUENCY;
pub const MOD_MAXERROR: i32 = ADJ_MAXERROR;
pub const MOD_ESTERROR: i32 = ADJ_ESTERROR;
pub const MOD_STATUS: i32 = ADJ_STATUS;
pub const MOD_TIMECONST: i32 = ADJ_TIMECONST;
pub const MOD_TAI: i32 = ADJ_TAI;
pub const MOD_MICRO: i32 = ADJ_MICRO;
pub const MOD_NANO: i32 = ADJ_NANO;
pub const STA_PLL: i32 = 0x0001;
pub const STA_PPSFREQ: i32 = 0x0002;
pub const STA_PPSTIME: i32 = 0x0004;
pub const STA_FLL: i32 = 0x0008;
pub const STA_INS: i32 = 0x0010;
pub const STA_DEL: i32 = 0x0020;
pub const STA_UNSYNC: i32 = 0x0040;
pub const STA_FREQHOLD: i32 = 0x0080;
pub const STA_PPSSIGNAL: i32 = 0x0100;
pub const STA_PPSJITTER: i32 = 0x0200;
pub const STA_PPSWANDER: i32 = 0x0400;
pub const STA_PPSERROR: i32 = 0x0800;
pub const STA_CLOCKERR: i32 = 0x1000;
pub const STA_NANO: i32 = 0x2000;
pub const STA_MODE: i32 = 0x4000;
pub const STA_CLK: i32 = 0x8000;
pub const STA_RONLY: i32 = (STA_PPSSIGNAL
| STA_PPSJITTER
| STA_PPSWANDER
| STA_PPSERROR
| STA_CLOCKERR
| STA_NANO
| STA_MODE
| STA_CLK);
pub const TIME_OK: i32 = 0;
pub const TIME_INS: i32 = 1;
pub const TIME_DEL: i32 = 2;
pub const TIME_OOP: i32 = 3;
pub const TIME_WAIT: i32 = 4;
pub const TIME_ERROR: i32 = 5;
pub const TIME_BAD: i32 = TIME_ERROR;