@@ -312,6 +312,35 @@ s! {
312312 pub ll_host: [ :: c_char; UT_HOSTSIZE ] ,
313313 pub ll_time: :: time_t
314314 }
315+
316+ pub struct timex {
317+ pub modes: :: c_uint,
318+ pub offset: :: c_long,
319+ pub freq: :: c_long,
320+ pub maxerror: :: c_long,
321+ pub esterror: :: c_long,
322+ pub status: :: c_int,
323+ pub constant: :: c_long,
324+ pub precision: :: c_long,
325+ pub tolerance: :: c_long,
326+ pub ppsfreq: :: c_long,
327+ pub jitter: :: c_long,
328+ pub shift: :: c_int,
329+ pub stabil: :: c_long,
330+ pub jitcnt: :: c_long,
331+ pub calcnt: :: c_long,
332+ pub errcnt: :: c_long,
333+ pub stbcnt: :: c_long,
334+ }
335+
336+ pub struct ntptimeval {
337+ pub time: :: timespec,
338+ pub maxerror: :: c_long,
339+ pub esterror: :: c_long,
340+ pub tai: :: c_long,
341+ pub time_state: :: c_int,
342+ }
343+
315344}
316345
317346s_no_extra_traits ! {
@@ -1233,6 +1262,58 @@ pub const BIOCSDLT: ::c_ulong = 0x80044278;
12331262pub const BIOCGSEESENT : :: c_ulong = 0x40044276 ;
12341263pub const BIOCSSEESENT : :: c_ulong = 0x80044277 ;
12351264
1265+ //<sys/timex.h>
1266+ pub const NTP_API : :: c_int = 4 ;
1267+ pub const MAXPHASE : :: c_long = 500000000 ;
1268+ pub const MAXFREQ : :: c_long = 500000 ;
1269+ pub const MINSEC : :: c_int = 256 ;
1270+ pub const MAXSEC : :: c_int = 2048 ;
1271+ pub const NANOSECOND : :: c_long = 1000000000 ;
1272+ pub const SCALE_PPM : :: c_int = 65 ;
1273+ pub const MAXTC : :: c_int = 10 ;
1274+ pub const MOD_OFFSET : :: c_uint = 0x0001 ;
1275+ pub const MOD_FREQUENCY : :: c_uint = 0x0002 ;
1276+ pub const MOD_MAXERROR : :: c_uint = 0x0004 ;
1277+ pub const MOD_ESTERROR : :: c_uint = 0x0008 ;
1278+ pub const MOD_STATUS : :: c_uint = 0x0010 ;
1279+ pub const MOD_TIMECONST : :: c_uint = 0x0020 ;
1280+ pub const MOD_PPSMAX : :: c_uint = 0x0040 ;
1281+ pub const MOD_TAI : :: c_uint = 0x0080 ;
1282+ pub const MOD_MICRO : :: c_uint = 0x1000 ;
1283+ pub const MOD_NANO : :: c_uint = 0x2000 ;
1284+ pub const MOD_CLKB : :: c_uint = 0x4000 ;
1285+ pub const MOD_CLKA : :: c_uint = 0x8000 ;
1286+ pub const STA_PLL : :: c_int = 0x0001 ;
1287+ pub const STA_PPSFREQ : :: c_int = 0x0002 ;
1288+ pub const STA_PPSTIME : :: c_int = 0x0004 ;
1289+ pub const STA_FLL : :: c_int = 0x0008 ;
1290+ pub const STA_INS : :: c_int = 0x0010 ;
1291+ pub const STA_DEL : :: c_int = 0x0020 ;
1292+ pub const STA_UNSYNC : :: c_int = 0x0040 ;
1293+ pub const STA_FREQHOLD : :: c_int = 0x0080 ;
1294+ pub const STA_PPSSIGNAL : :: c_int = 0x0100 ;
1295+ pub const STA_PPSJITTER : :: c_int = 0x0200 ;
1296+ pub const STA_PPSWANDER : :: c_int = 0x0400 ;
1297+ pub const STA_PPSERROR : :: c_int = 0x0800 ;
1298+ pub const STA_CLOCKERR : :: c_int = 0x1000 ;
1299+ pub const STA_NANO : :: c_int = 0x2000 ;
1300+ pub const STA_MODE : :: c_int = 0x4000 ;
1301+ pub const STA_CLK : :: c_int = 0x8000 ;
1302+ pub const STA_RONLY : :: c_int = STA_PPSSIGNAL
1303+ | STA_PPSJITTER
1304+ | STA_PPSWANDER
1305+ | STA_PPSERROR
1306+ | STA_CLOCKERR
1307+ | STA_NANO
1308+ | STA_MODE
1309+ | STA_CLK ;
1310+ pub const TIME_OK : :: c_int = 0 ;
1311+ pub const TIME_INS : :: c_int = 1 ;
1312+ pub const TIME_DEL : :: c_int = 2 ;
1313+ pub const TIME_OOP : :: c_int = 3 ;
1314+ pub const TIME_WAIT : :: c_int = 4 ;
1315+ pub const TIME_ERROR : :: c_int = 5 ;
1316+
12361317cfg_if ! {
12371318 if #[ cfg( any( target_arch = "sparc" , target_arch = "sparc64" ,
12381319 target_arch = "x86" , target_arch = "x86_64" ) ) ] {
@@ -1649,6 +1730,11 @@ f! {
16491730 }
16501731}
16511732
1733+ extern "C" {
1734+ pub fn ntp_adjtime ( buf : * mut timex ) -> :: c_int ;
1735+ pub fn ntp_gettime ( buf : * mut ntptimeval ) -> :: c_int ;
1736+ }
1737+
16521738#[ link( name = "rt" ) ]
16531739extern "C" {
16541740 pub fn aio_read ( aiocbp : * mut aiocb ) -> :: c_int ;
0 commit comments