pub struct Timestamp { /* private fields */ }Expand description
A timestamp as they occur in PTP messages.
This is a number of seconds and nanoseconds since the epoch of the timescale in use. For the PTP timescale the epoch is 00:00:00TAI on January 1, 1970.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn new(seconds: u64, nanos: u32) -> Result<Self, Error>
pub fn new(seconds: u64, nanos: u32) -> Result<Self, Error>
Try to create a new timestamp with the given number of seconds and nanoseconds since the epoch.
§Errors
This function fails if the number of seconds is larger than or equal to 2^48, or when the number of nanoseconds represents more than a whole second.
Sourcepub fn try_set_seconds(&mut self, seconds: u64) -> Result<(), Error>
pub fn try_set_seconds(&mut self, seconds: u64) -> Result<(), Error>
Update the whole number of seconds since the epoch.
§Errors
This fails when the number of seconds is larger than or eque
Sourcepub fn try_set_nanos(&mut self, nanos: u32) -> Result<(), Error>
pub fn try_set_nanos(&mut self, nanos: u32) -> Result<(), Error>
Update the number of nanoseconds passed.
§Errors
This fails when the number of nanoseconds is larger than a whole second.
Trait Implementations§
impl Copy for Timestamp
impl Eq for Timestamp
Source§impl Ord for Timestamp
impl Ord for Timestamp
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Forget for Timestamp
impl Freeze for Timestamp
impl Move for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnsafeUnpin for Timestamp
impl UnwindSafe for Timestamp
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