pub struct Timestamp(/* private fields */);Expand description
A timestamp, defined as the number of seconds since UNIX EPOCH.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub const fn from_raw(raw: u64) -> Option<Timestamp>
pub const fn from_raw(raw: u64) -> Option<Timestamp>
Returns the timestamp from its raw, C-FFI compatible representation.
This returns None if raw is 0.
Sourcepub const fn seconds_since_epoch(self) -> u64
pub const fn seconds_since_epoch(self) -> u64
Returns the number of seconds since EPOCH that this timestamp represents.
Sourcepub fn duration_since_epoch(self) -> Duration
pub fn duration_since_epoch(self) -> Duration
Returns the duration since EPOCH that this timestamp represents.
Sourcepub fn optional_to_raw(timestamp: Option<Timestamp>) -> u64
pub fn optional_to_raw(timestamp: Option<Timestamp>) -> u64
Gets the raw, C-FFI representation of a given optional timestamp.
If timestamp is None, this returns 0.
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 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