pub struct NtpTimestamp(pub u64);Expand description
64-bit NTP timestamp: 32.32 fixed-point seconds since the era epoch.
Tuple Fields§
§0: u64Implementations§
Source§impl NtpTimestamp
impl NtpTimestamp
pub const ZERO: NtpTimestamp
pub fn from_parts(seconds: u32, fraction: u32) -> Self
pub fn seconds(self) -> u32
pub fn fraction(self) -> u32
Sourcepub fn from_unix(secs: i64, nanos: u32) -> Self
pub fn from_unix(secs: i64, nanos: u32) -> Self
Build from Unix wall time. Era wrap (2036) is handled by truncation to the low 32 bits of the NTP second count, per RFC 5905 era arithmetic.
Sourcepub fn seconds_since(self, earlier: NtpTimestamp) -> f64
pub fn seconds_since(self, earlier: NtpTimestamp) -> f64
Signed seconds from earlier to self, correct across era wrap for spans
under ±68 years (the same guarantee RFC 5905 gives).
pub fn is_zero(self) -> bool
Trait Implementations§
Source§impl Clone for NtpTimestamp
impl Clone for NtpTimestamp
Source§fn clone(&self) -> NtpTimestamp
fn clone(&self) -> NtpTimestamp
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for NtpTimestamp
Source§impl Debug for NtpTimestamp
impl Debug for NtpTimestamp
Source§impl Default for NtpTimestamp
impl Default for NtpTimestamp
Source§fn default() -> NtpTimestamp
fn default() -> NtpTimestamp
Returns the “default value” for a type. Read more
impl Eq 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