pub struct Timestamp(/* private fields */);Expand description
Moment in UTC with millisecond resolution; never before the Unix epoch.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub const fn from_millis(millis: i64) -> Result<Self, ValueError>
pub const fn from_millis(millis: i64) -> Result<Self, ValueError>
Wraps a number of milliseconds since the Unix epoch.
§Errors
Returns ValueError::OutOfRange when the number is negative.
Sourcepub fn from_minutes(minutes: u32) -> Self
pub fn from_minutes(minutes: u32) -> Self
Converts a number of minutes since the Unix epoch, as trendbars carry it.
Sourcepub fn now() -> Self
pub fn now() -> Self
Returns the current time of the system clock.
A clock set before the Unix epoch yields the epoch.
Sourcepub fn checked_add(self, duration: Duration) -> Option<Self>
pub fn checked_add(self, duration: Duration) -> Option<Self>
Returns the moment duration later, or None when it cannot be represented.
Sourcepub fn checked_sub(self, duration: Duration) -> Option<Self>
pub fn checked_sub(self, duration: Duration) -> Option<Self>
Returns the moment duration earlier, or None when it lies before the Unix epoch.
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
Source§impl TryFrom<SystemTime> for Timestamp
impl TryFrom<SystemTime> for Timestamp
Source§type Error = ValueError
type Error = ValueError
The type returned in the event of a conversion error.
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