Struct clocksource::precise::Instant
source · pub struct Instant { /* private fields */ }
Expand description
A measurement of a monotonically nodecreasing clock in nanoseconds.
It is opaque and useful only with the duration types.
Unlike std::time::Instant
the internal representation use only nanoseconds
in a u64
field to hold the clock reading. This means that they will wrap
after ~584 years.
As with std::time::Instant
, instants are not guaranteed to be steady. They
are taken from a clock which is subject to phase and frequency adjustments.
This means that they may jump forward or speed up or slow down. Barring any
platform bugs, it is expected that they are always monotonically
nondecreasing.
The size of a precise::Instant
is always the same as a u64
.
Implementations§
source§impl Instant
impl Instant
sourcepub fn elapsed(&self) -> Duration
pub fn elapsed(&self) -> Duration
Return the elapsed time, in nanoseconds, since the original timestamp.
sourcepub fn duration_since(&self, earlier: Self) -> Duration
pub fn duration_since(&self, earlier: Self) -> Duration
Return the elapsed duration, in nanoseconds, from some earlier timestamp until this timestamp.
pub fn checked_duration_since(&self, earlier: Self) -> Option<Duration>
pub fn checked_sub(&self, duration: Duration) -> Option<Self>
Trait Implementations§
source§impl AddAssign<Duration> for Instant
impl AddAssign<Duration> for Instant
source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
+=
operation. Read moresource§impl AddAssign<Duration> for Instant
impl AddAssign<Duration> for Instant
source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
+=
operation. Read moresource§impl From<Instant> for AtomicInstant
impl From<Instant> for AtomicInstant
source§impl Ord for Instant
impl Ord for Instant
source§impl PartialEq for Instant
impl PartialEq for Instant
source§impl PartialOrd for Instant
impl PartialOrd for Instant
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl SubAssign<Duration> for Instant
impl SubAssign<Duration> for Instant
source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
-=
operation. Read moresource§impl SubAssign<Duration> for Instant
impl SubAssign<Duration> for Instant
source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
-=
operation. Read more