pub struct NtpTimestamp {
pub seconds: u32,
pub fraction: u32,
}Expand description
NTP timestamp: 32-bit seconds since 1900-01-01 + 32-bit fraction.
Fields§
§seconds: u32Seconds since 1900-01-01
fraction: u32Fractional seconds (2^-32 second units)
Implementations§
Source§impl NtpTimestamp
impl NtpTimestamp
Sourcepub fn from_unix(epoch_secs: u64, millis: u32) -> Self
pub fn from_unix(epoch_secs: u64, millis: u32) -> Self
Create from Unix epoch seconds + milliseconds.
Sourcepub fn to_unix_secs(&self) -> u64
pub fn to_unix_secs(&self) -> u64
Convert to Unix epoch seconds (truncated).
Sourcepub fn from_bytes(bytes: &[u8; 8]) -> Self
pub fn from_bytes(bytes: &[u8; 8]) -> Self
Deserialize from 8 big-endian bytes.
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§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§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
Source§impl PartialEq for NtpTimestamp
impl PartialEq for NtpTimestamp
impl Copy for NtpTimestamp
impl Eq 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 UnwindSafe for NtpTimestamp
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)