pub struct NtpTimestamp {
pub seconds: u32,
pub fraction: u32,
}Expand description
NTP Timestamp - RFC 7011 Sections 6.1.9 and 6.1.10
Used by dateTimeMicroseconds and dateTimeNanoseconds: seconds since the
NTP epoch (1 January 1900) and a binary fraction of a second. For
dateTimeMicroseconds, the lower 11 bits of the fraction SHOULD be zero.
Fields§
§seconds: u32Seconds since 1 January 1900 00:00 UTC
fraction: u32Fraction of a second, in units of 2^-32 seconds
Implementations§
Source§impl NtpTimestamp
impl NtpTimestamp
Sourcepub const UNIX_EPOCH_OFFSET: u64 = 2_208_988_800
pub const UNIX_EPOCH_OFFSET: u64 = 2_208_988_800
Offset between the NTP epoch (1900) and the UNIX epoch (1970), in seconds
Sourcepub fn unix_nanos(&self) -> Option<u64>
pub fn unix_nanos(&self) -> Option<u64>
Nanoseconds since the UNIX epoch, or None if the timestamp is before
1970. Note that RFC 7011 Section 5.2 does not handle the NTP era
wraparound (2036); this conversion assumes era 0.
Trait Implementations§
Source§impl Clone for NtpTimestamp
impl Clone for NtpTimestamp
impl Copy for NtpTimestamp
Source§impl Debug for NtpTimestamp
impl Debug for NtpTimestamp
impl Eq for NtpTimestamp
Source§impl Hash for NtpTimestamp
impl Hash for NtpTimestamp
Source§impl PartialEq for NtpTimestamp
impl PartialEq for NtpTimestamp
impl StructuralPartialEq for NtpTimestamp
Auto Trait Implementations§
impl Freeze for NtpTimestamp
impl RefUnwindSafe for NtpTimestamp
impl Send for NtpTimestamp
impl Sync for NtpTimestamp
impl Unpin for NtpTimestamp
impl UnsafeUnpin for NtpTimestamp
impl UnwindSafe for NtpTimestamp
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