pub struct NtpResult {
pub seconds: u32,
pub seconds_fraction: u32,
pub roundtrip: u64,
pub offset: i64,
pub stratum: u8,
pub precision: i8,
}
Expand description
SNTP request result representation
Fields§
§seconds: u32
NTP server seconds value
seconds_fraction: u32
NTP server seconds fraction value
roundtrip: u64
Request roundtrip time in microseconds
offset: i64
Estimated difference between the NTP reference and the system time in microseconds
stratum: u8
Clock stratum of NTP server
precision: i8
Precision of NTP server as log2(seconds) - this should usually be negative
Implementations§
source§impl NtpResult
impl NtpResult
sourcepub fn new(
seconds: u32,
seconds_fraction: u32,
roundtrip: u64,
offset: i64,
stratum: u8,
precision: i8
) -> Self
pub fn new( seconds: u32, seconds_fraction: u32, roundtrip: u64, offset: i64, stratum: u8, precision: i8 ) -> Self
Create new NTP result Args:
seconds
- number of secondsseconds_fraction
- number of seconds fractionroundtrip
- calculated roundtrip in microsecondsoffset
- calculated system clock offset in microsecondsstratum
- integer indicating the stratum (level of server’s hierarchy to stratum 0 - “reference clock”)precision
- an exponent of two, where the resulting value is the precision of the system clock in seconds
sourcepub fn sec_fraction(&self) -> u32
pub fn sec_fraction(&self) -> u32
Returns number of seconds fraction reported by an NTP server
sourcepub fn roundtrip(&self) -> u64
pub fn roundtrip(&self) -> u64
Returns request’s roundtrip time (client -> server -> client) in microseconds
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for NtpResult
impl Send for NtpResult
impl Sync for NtpResult
impl Unpin for NtpResult
impl UnwindSafe for NtpResult
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more