pub struct TimePoint { /* private fields */ }Expand description
uint64_t, Unix time as nanoseconds elapsed since January 1, 1970 UTC
Implementations§
Source§impl TimePoint
impl TimePoint
Sourcepub const UNIX_EPOCH: TimePoint
pub const UNIX_EPOCH: TimePoint
The Unix epoch, 1970-01-01T00:00:00Z: the timepoint every other one counts nanoseconds from.
TimePoint::UNIX_EPOCH + Duration::from_secs(secs) builds a timepoint
from a Unix seconds value, and
t.duration_since(&TimePoint::UNIX_EPOCH) reads one back.
Sourcepub fn checked_add(&self, duration: Duration) -> Option<TimePoint>
pub fn checked_add(&self, duration: Duration) -> Option<TimePoint>
self + duration, or None if that is past the end of the
representable range.
Sourcepub fn checked_sub(&self, duration: Duration) -> Option<TimePoint>
pub fn checked_sub(&self, duration: Duration) -> Option<TimePoint>
self - duration, or None if that is before the Unix epoch.
Sourcepub fn saturating_add(&self, duration: Duration) -> TimePoint
pub fn saturating_add(&self, duration: Duration) -> TimePoint
self + duration, or the latest representable timepoint if that
overflows.
The natural form for a deadline that a caller-supplied span may push past the end of the range: the result then simply reads as “never”.
Sourcepub fn saturating_sub(&self, duration: Duration) -> TimePoint
pub fn saturating_sub(&self, duration: Duration) -> TimePoint
self - duration, or TimePoint::UNIX_EPOCH if that would
precede it.
Sourcepub fn duration_since(&self, earlier: &TimePoint) -> Duration
pub fn duration_since(&self, earlier: &TimePoint) -> Duration
The time from earlier to self, or Duration::ZERO if earlier
is in fact later.
The same as self - earlier.
Sourcepub fn checked_duration_since(&self, earlier: &TimePoint) -> Option<Duration>
pub fn checked_duration_since(&self, earlier: &TimePoint) -> Option<Duration>
The time from earlier to self, or None if earlier is in fact
later.
Trait Implementations§
Source§impl AddAssign<Duration> for TimePoint
impl AddAssign<Duration> for TimePoint
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
+= operation. Read moreSource§impl ConstMaxSize for TimePoint
impl ConstMaxSize for TimePoint
Source§impl ConstMaxSize for TimePoint
impl ConstMaxSize for TimePoint
impl EncodesAs<TimePoint> for TimePoint
impl Eq for TimePoint
Source§impl JsonSchema for TimePoint
impl JsonSchema for TimePoint
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for TimePoint
impl Ord for TimePoint
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for TimePoint
impl PartialOrd for TimePoint
Source§impl<'_r> ReadXDR<'_r> for TimePoint
impl<'_r> ReadXDR<'_r> for TimePoint
impl StructuralPartialEq for TimePoint
Source§impl SubAssign<Duration> for TimePoint
impl SubAssign<Duration> for TimePoint
Source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
-= operation. Read more