pub struct Timestamp(/* private fields */);Expand description
Timestamp as seconds since Unix epoch
Implementations§
Source§impl Timestamp
impl Timestamp
pub const ZERO: Self
pub const MAX: Self
Sourcepub const fn as_u64(self) -> u64
pub const fn as_u64(self) -> u64
Get the underlying timestamp value as seconds since Unix epoch
Sourcepub const fn saturating_add_secs(self, secs: u64) -> Self
pub const fn saturating_add_secs(self, secs: u64) -> Self
Add seconds to this timestamp (saturating at Timestamp::MAX).
Sourcepub const fn secs_since(self, earlier: Self) -> u64
pub const fn secs_since(self, earlier: Self) -> u64
Seconds elapsed since earlier, or 0 if earlier is after self.
Sourcepub fn to_offset_date_time(self) -> Option<OffsetDateTime>
pub fn to_offset_date_time(self) -> Option<OffsetDateTime>
Convert to time::OffsetDateTime
Trait Implementations§
impl Copy for Timestamp
impl Eq for Timestamp
Source§impl From<Timestamp> for TimestampFixed
impl From<Timestamp> for TimestampFixed
Source§impl From<TimestampFixed> for Timestamp
impl From<TimestampFixed> for Timestamp
Source§fn from(value: TimestampFixed) -> Self
fn from(value: TimestampFixed) -> Self
Converts to this type from the input type.
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