pub struct TimeStamp { /* private fields */ }Expand description
A fixed point in time relative to the reference point in time.
Implementations§
Source§impl TimeStamp
impl TimeStamp
Sourcepub const fn never() -> Self
pub const fn never() -> Self
Constructs the largest possible time stamp.
It is practically impossible to reach it without using artificially large time spans.
Sourcepub fn from_elapsed(nanos: u64) -> Option<Self>
pub fn from_elapsed(nanos: u64) -> Option<Self>
Constructs time stamp from number of nanoseconds elapsed since reference point in time.
Sourcepub unsafe fn new_unchecked(nanos: u64) -> Self
pub unsafe fn new_unchecked(nanos: u64) -> Self
Constructs time stamp from number of nanoseconds elapsed since reference point in time.
§Safety
nanos must not be 0.
Sourcepub fn from_duration(duration: Duration) -> Option<Self>
pub fn from_duration(duration: Duration) -> Option<Self>
Constructs time stamp from duration since reference point in time.
Sourcepub fn from_observed_duration(duration: Duration) -> Self
pub fn from_observed_duration(duration: Duration) -> Self
Constructs time stamp from duration observed by the process.
Given that duration is measured by the process, it is impossible to overflow as it would mean that process runs for more than 500 years.
§Panics
Panics if overflow occurs.
pub const fn checked_elapsed_since(self, earlier: TimeStamp) -> Option<TimeSpan>
pub fn elapsed_since(self, earlier: TimeStamp) -> TimeSpan
pub fn elapsed_since_start(self) -> TimeSpan
pub fn nanos_since_start(self) -> u64
pub fn add_span(self, span: TimeSpan) -> Option<TimeStamp>
Trait Implementations§
Source§impl AddAssign<TimeSpan> for TimeStamp
impl AddAssign<TimeSpan> for TimeStamp
Source§fn add_assign(&mut self, rhs: TimeSpan)
fn add_assign(&mut self, rhs: TimeSpan)
Performs the
+= operation. Read moreSource§impl Ord for TimeStamp
impl Ord for TimeStamp
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 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