interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / vendor / libc / src / new / netbsd / sys / timex.rs

95 lines · 2658 bytes Raw Blame History
1//! Header: `sys/timex.h`
2//!
3//! <https://github.com/NetBSD/src/tree/trunk/sys/sys/timex.h>
4
5use crate::prelude::*;
6
7pub const MAXPHASE: c_long = 500000000;
8pub const MAXFREQ: c_long = 500000;
9pub const MINSEC: c_int = 256;
10pub const MAXSEC: c_int = 2048;
11pub const NANOSECOND: c_long = 1000000000;
12pub const SCALE_PPM: c_int = 65;
13pub const MAXTC: c_int = 10;
14
15pub const MOD_OFFSET: c_uint = 0x0001;
16pub const MOD_FREQUENCY: c_uint = 0x0002;
17pub const MOD_MAXERROR: c_uint = 0x0004;
18pub const MOD_ESTERROR: c_uint = 0x0008;
19pub const MOD_STATUS: c_uint = 0x0010;
20pub const MOD_TIMECONST: c_uint = 0x0020;
21pub const MOD_PPSMAX: c_uint = 0x0040;
22pub const MOD_TAI: c_uint = 0x0080;
23pub const MOD_MICRO: c_uint = 0x1000;
24pub const MOD_NANO: c_uint = 0x2000;
25pub const MOD_CLKB: c_uint = 0x4000;
26pub const MOD_CLKA: c_uint = 0x8000;
27
28pub const STA_PLL: c_int = 0x0001;
29pub const STA_PPSFREQ: c_int = 0x0002;
30pub const STA_PPSTIME: c_int = 0x0004;
31pub const STA_FLL: c_int = 0x0008;
32pub const STA_INS: c_int = 0x0010;
33pub const STA_DEL: c_int = 0x0020;
34pub const STA_UNSYNC: c_int = 0x0040;
35pub const STA_FREQHOLD: c_int = 0x0080;
36pub const STA_PPSSIGNAL: c_int = 0x0100;
37pub const STA_PPSJITTER: c_int = 0x0200;
38pub const STA_PPSWANDER: c_int = 0x0400;
39pub const STA_PPSERROR: c_int = 0x0800;
40pub const STA_CLOCKERR: c_int = 0x1000;
41pub const STA_NANO: c_int = 0x2000;
42pub const STA_MODE: c_int = 0x4000;
43pub const STA_CLK: c_int = 0x8000;
44
45pub const STA_RONLY: c_int = STA_PPSSIGNAL
46 | STA_PPSJITTER
47 | STA_PPSWANDER
48 | STA_PPSERROR
49 | STA_CLOCKERR
50 | STA_NANO
51 | STA_MODE
52 | STA_CLK;
53
54pub const TIME_OK: c_int = 0;
55pub const TIME_INS: c_int = 1;
56pub const TIME_DEL: c_int = 2;
57pub const TIME_OOP: c_int = 3;
58pub const TIME_WAIT: c_int = 4;
59pub const TIME_ERROR: c_int = 5;
60
61s! {
62 pub struct ntptimeval {
63 pub time: crate::timespec,
64 pub maxerror: c_long,
65 pub esterror: c_long,
66 pub tai: c_long,
67 pub time_state: c_int,
68 }
69
70 pub struct timex {
71 pub modes: c_uint,
72 pub offset: c_long,
73 pub freq: c_long,
74 pub maxerror: c_long,
75 pub esterror: c_long,
76 pub status: c_int,
77 pub constant: c_long,
78 pub precision: c_long,
79 pub tolerance: c_long,
80 pub ppsfreq: c_long,
81 pub jitter: c_long,
82 pub shift: c_int,
83 pub stabil: c_long,
84 pub jitcnt: c_long,
85 pub calcnt: c_long,
86 pub errcnt: c_long,
87 pub stbcnt: c_long,
88 }
89}
90
91extern "C" {
92 #[link_name = "__ntp_gettime50"]
93 pub fn ntp_gettime(buf: *mut ntptimeval) -> c_int;
94 pub fn ntp_adjtime(buf: *mut timex) -> c_int;
95}