pub struct Timestamp(/* private fields */);Expand description
Signed nanoseconds since 1970-01-01 00:00:00 UTC, without timezone or DST. Leap seconds follow the supplying source’s Unix/POSIX time convention. The full i128 range is representable; conversions and clock arithmetic are checked.
Implementations§
Source§impl Timestamp
impl Timestamp
pub const fn from_nanos(nanoseconds: i128) -> Self
pub const fn as_nanos(self) -> i128
Sourcepub fn try_as_seconds(self) -> Result<i64>
pub fn try_as_seconds(self) -> Result<i64>
Whole Unix seconds, rounding toward the past (including before the epoch).
Sourcepub fn try_into_duration(self) -> Result<Duration>
pub fn try_into_duration(self) -> Result<Duration>
Convert for consumers whose timestamp format excludes pre-epoch dates.
Trait Implementations§
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 Copy for Timestamp
impl Eq 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