@@ -401,6 +401,33 @@ s! {
401
401
pub ut_exit: exit_status,
402
402
pub ut_time: :: time_t,
403
403
}
404
+
405
+ pub struct timex {
406
+ pub modes: u32 ,
407
+ pub offset: i32 ,
408
+ pub freq: i32 ,
409
+ pub maxerror: i32 ,
410
+ pub esterror: i32 ,
411
+ pub status: i32 ,
412
+ pub constant: i32 ,
413
+ pub precision: i32 ,
414
+ pub tolerance: i32 ,
415
+ pub ppsfreq: i32 ,
416
+ pub jitter: i32 ,
417
+ pub shift: i32 ,
418
+ pub stabil: i32 ,
419
+ pub jitcnt: i32 ,
420
+ pub calcnt: i32 ,
421
+ pub errcnt: i32 ,
422
+ pub stbcnt: i32 ,
423
+ }
424
+
425
+ pub struct ntptimeval {
426
+ pub time: :: timeval,
427
+ pub maxerror: i32 ,
428
+ pub esterror: i32 ,
429
+ }
430
+
404
431
}
405
432
406
433
s_no_extra_traits ! {
@@ -1963,6 +1990,58 @@ pub const SOCK_CLOEXEC: ::c_int = 0x080000;
1963
1990
pub const SOCK_NONBLOCK : :: c_int = 0x100000 ;
1964
1991
pub const SOCK_NDELAY : :: c_int = 0x200000 ;
1965
1992
1993
+ //<sys/timex.h>
1994
+ pub const SCALE_KG : :: c_int = ( 1 << 6 ) ;
1995
+ pub const SCALE_KF : :: c_int = ( 1 << 16 ) ;
1996
+ pub const SCALE_KH : :: c_int = ( 1 << 2 ) ;
1997
+ pub const MAXTC : :: c_int = ( 1 << 6 ) ;
1998
+ pub const SCALE_PHASE : :: c_int = ( 1 << 22 ) ;
1999
+ pub const SCALE_USEC : :: c_int = ( 1 << 16 ) ;
2000
+ pub const SCALE_UPDATE : :: c_int = ( SCALE_KG * MAXTC ) ;
2001
+ pub const FINEUSEC : :: c_int = ( 1 << 22 ) ;
2002
+ pub const MAXPHASE : :: c_int = 512000 ;
2003
+ pub const MAXFREQ : :: c_int = ( 512 * SCALE_USEC ) ;
2004
+ pub const MAXTIME : :: c_int = ( 200 << PPS_AVG ) ;
2005
+ pub const MINSEC : :: c_int = 16 ;
2006
+ pub const MAXSEC : :: c_int = 1200 ;
2007
+ pub const PPS_AVG : :: c_int = 2 ;
2008
+ pub const PPS_SHIFT : :: c_int = 2 ;
2009
+ pub const PPS_SHIFTMAX : :: c_int = 8 ;
2010
+ pub const PPS_VALID : :: c_int = 120 ;
2011
+ pub const MAXGLITCH : :: c_int = 30 ;
2012
+ pub const MOD_OFFSET : u32 = 0x0001 ;
2013
+ pub const MOD_FREQUENCY : u32 = 0x0002 ;
2014
+ pub const MOD_MAXERROR : u32 = 0x0004 ;
2015
+ pub const MOD_ESTERROR : u32 = 0x0008 ;
2016
+ pub const MOD_STATUS : u32 = 0x0010 ;
2017
+ pub const MOD_TIMECONST : u32 = 0x0020 ;
2018
+ pub const MOD_CLKB : u32 = 0x4000 ;
2019
+ pub const MOD_CLKA : u32 = 0x8000 ;
2020
+ pub const STA_PLL : u32 = 0x0001 ;
2021
+ pub const STA_PPSFREQ : i32 = 0x0002 ;
2022
+ pub const STA_PPSTIME : i32 = 0x0004 ;
2023
+ pub const STA_FLL : i32 = 0x0008 ;
2024
+ pub const STA_INS : i32 = 0x0010 ;
2025
+ pub const STA_DEL : i32 = 0x0020 ;
2026
+ pub const STA_UNSYNC : i32 = 0x0040 ;
2027
+ pub const STA_FREQHOLD : i32 = 0x0080 ;
2028
+ pub const STA_PPSSIGNAL : i32 = 0x0100 ;
2029
+ pub const STA_PPSJITTER : i32 = 0x0200 ;
2030
+ pub const STA_PPSWANDER : i32 = 0x0400 ;
2031
+ pub const STA_PPSERROR : i32 = 0x0800 ;
2032
+ pub const STA_CLOCKERR : i32 = 0x1000 ;
2033
+ pub const STA_RONLY : i32 = ( STA_PPSSIGNAL
2034
+ | STA_PPSJITTER
2035
+ | STA_PPSWANDER
2036
+ | STA_PPSERROR
2037
+ | STA_CLOCKERR ) ;
2038
+ pub const TIME_OK : i32 = 0 ;
2039
+ pub const TIME_INS : i32 = 1 ;
2040
+ pub const TIME_DEL : i32 = 2 ;
2041
+ pub const TIME_OOP : i32 = 3 ;
2042
+ pub const TIME_WAIT : i32 = 4 ;
2043
+ pub const TIME_ERROR : i32 = 5 ;
2044
+
1966
2045
f ! {
1967
2046
pub fn FD_CLR ( fd: :: c_int, set: * mut fd_set) -> ( ) {
1968
2047
let bits = :: mem:: size_of_val( & ( * set) . fds_bits[ 0 ] ) * 8 ;
@@ -2496,6 +2575,9 @@ extern "C" {
2496
2575
pub fn getutmp ( ux : * const utmpx , u : * mut utmp ) ;
2497
2576
pub fn getutmpx ( u : * const utmp , ux : * mut utmpx ) ;
2498
2577
pub fn updwtmp ( file : * const :: c_char , u : * mut utmp ) ;
2578
+
2579
+ pub fn ntp_adjtime ( buf : * mut timex ) -> :: c_int ;
2580
+ pub fn ntp_gettime ( buf : * mut ntptimeval ) -> :: c_int ;
2499
2581
}
2500
2582
2501
2583
mod compat;
0 commit comments