]> git.proxmox.com Git - wasi-libc.git/blob - libc-top-half/musl/include/sys/timex.h
WASI libc prototype implementation.
[wasi-libc.git] / libc-top-half / musl / include / sys / timex.h
1 #ifndef _SYS_TIMEX_H
2 #define _SYS_TIMEX_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #define __NEED_clockid_t
9
10 #include <bits/alltypes.h>
11
12 #include <sys/time.h>
13
14 struct ntptimeval {
15 struct timeval time;
16 long maxerror, esterror;
17 };
18
19 struct 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
39 #define ADJ_SETOFFSET 0x0100
40 #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
54 #define MOD_TAI ADJ_TAI
55 #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 | \
79 STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
80
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
91 int adjtimex(struct timex *);
92 int clock_adjtime(clockid_t, struct timex *);
93
94 #ifdef __cplusplus
95 }
96 #endif
97
98 #endif