pub struct Timestamp(/* private fields */);Expand description
Microseconds since the Unix epoch, stored as a u64.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub const fn from_micros(micros: u64) -> Self
pub const fn from_micros(micros: u64) -> Self
Construct from a microsecond count.
Sourcepub const fn from_millis(millis: u64) -> Self
pub const fn from_millis(millis: u64) -> Self
Construct from a millisecond count (converted to microseconds).
Sourcepub const fn from_secs(secs: u64) -> Self
pub const fn from_secs(secs: u64) -> Self
Construct from a whole-second count (converted to microseconds).
Sourcepub const fn saturating_add(self, micros: u64) -> Self
pub const fn saturating_add(self, micros: u64) -> Self
Add micros microseconds, saturating at u64::MAX.
Sourcepub const fn saturating_sub(self, micros: u64) -> Self
pub const fn saturating_sub(self, micros: u64) -> Self
Subtract micros microseconds, saturating at zero.
Sourcepub const fn duration_since(self, earlier: Self) -> u64
pub const fn duration_since(self, earlier: Self) -> u64
Return the elapsed microseconds between earlier and self, saturating at zero.
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
Source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Freeze 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