Debian Codegraph @

share/libc/sys/timex.h

raw
1 /**************************************************************************/
2 /* */
3 /* This file is part of Frama-C. */
4 /* */
5 /* Copyright (C) 2007-2022 */
6 /* CEA (Commissariat à l'énergie atomique et aux énergies */
7 /* alternatives) */
8 /* */
9 /* you can redistribute it and/or modify it under the terms of the GNU */
10 /* Lesser General Public License as published by the Free Software */
11 /* Foundation, version 2.1. */
12 /* */
13 /* It is distributed in the hope that it will be useful, */
14 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
15 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
16 /* GNU Lesser General Public License for more details. */
17 /* */
18 /* See the GNU Lesser General Public License version 2.1 */
19 /* for more details (enclosed in the file licenses/LGPLv2.1). */
20 /* */
21 /**************************************************************************/
22
23 #ifndef _SYS_TIMEX_H
24 #define _SYS_TIMEX_H 1
25 #include "features.h"
26 #include "stdint.h"
27 #include "time.h"
28 __PUSH_FC_STDLIB
29
30 __BEGIN_DECLS
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_TICK 0x4000
39 #define ADJ_OFFSET_SINGLESHOT 0x8001
40
41 #define MOD_OFFSET ADJ_OFFSET
42 #define MOD_FREQUENCY ADJ_FREQUENCY
43 #define MOD_MAXERROR ADJ_MAXERROR
44 #define MOD_ESTERROR ADJ_ESTERROR
45 #define MOD_STATUS ADJ_STATUS
46 #define MOD_TIMECONST ADJ_TIMECONST
47 #define MOD_CLKB ADJ_TICK
48 #define MOD_CLKA ADJ_OFFSET_SINGLESHOT
49
50 #define STA_PLL 0x0001
51 #define STA_PPSFREQ 0x0002
52 #define STA_PPSTIME 0x0004
53 #define STA_FLL 0x0008
54
55 #define STA_INS 0x0010
56 #define STA_DEL 0x0020
57 #define STA_UNSYNC 0x0040
58 #define STA_FREQHOLD 0x0080
59
60 #define STA_PPSSIGNAL 0x0100
61 #define STA_PPSJITTER 0x0200
62 #define STA_PPSWANDER 0x0400
63 #define STA_PPSERROR 0x0800
64
65 #define STA_CLOCKERR 0x1000
66
67 #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
68 STA_PPSERROR | STA_CLOCKERR)
69
70 #define TIME_OK 0
71 #define TIME_INS 1
72 #define TIME_DEL 2
73 #define TIME_OOP 3
74 #define TIME_WAIT 4
75 #define TIME_ERROR 5
76 #define TIME_BAD TIME_ERROR
77
78 struct timex {
79 unsigned int modes;
80 int64_t offset;
81 int64_t freq;
82 int64_t maxerror;
83 int64_t esterror;
84 int status;
85 int64_t constant;
86 int64_t precision;
87 int64_t tolerance;
88 struct timeval time;
89 int64_t tick;
90
91 int64_t ppsfreq;
92 int64_t jitter;
93 int shift;
94 int64_t stabil;
95 int64_t jitcnt;
96 int64_t calcnt;
97 int64_t errcnt;
98 int64_t stbcnt;
99 int tai;
100
101 int32_t _padding[11];
102 };
103
104 extern int adjtimex(struct timex *buf);
105 extern int ntp_adjtime(struct timex *buf);
106
107 __END_DECLS
108
109 __POP_FC_STDLIB
110 #endif