pub struct Instant<T, U = NsUnit>(/* private fields */);
Expand description
A timestamp from the kernel. Generic over both the timeline and the units it is measured in.
Implementations§
Source§impl Instant<MonotonicTimeline>
impl Instant<MonotonicTimeline>
Sourcepub fn get() -> Self
pub fn get() -> Self
Get the current monotonic time which does not advance during system suspend.
Wraps the zx_clock_get_monotonic syscall.
Sourcepub fn after(duration: MonotonicDuration) -> Self
pub fn after(duration: MonotonicDuration) -> Self
Compute a deadline for the time in the future that is the given Duration
away.
Wraps the zx_deadline_after syscall.
Sourcepub fn sleep(self)
pub fn sleep(self)
Sleep until the given time.
Wraps the zx_nanosleep syscall.
Source§impl Instant<BootTimeline>
impl Instant<BootTimeline>
Sourcepub fn after(duration: BootDuration) -> Self
pub fn after(duration: BootDuration) -> Self
Compute a deadline for the time in the future that is the given Duration
away.
Source§impl<T: Timeline> Instant<T>
impl<T: Timeline> Instant<T>
pub const INFINITE: Instant<T, NsUnit>
pub const INFINITE_PAST: Instant<T, NsUnit>
Sourcepub const fn into_nanos(self) -> i64
pub const fn into_nanos(self) -> i64
Returns the number of nanoseconds since the epoch contained by this Time
.
Sourcepub const fn from_nanos(nanos: i64) -> Self
pub const fn from_nanos(nanos: i64) -> Self
Return a strongly-typed Time
from a raw number of nanoseconds.
Source§impl Instant<MonotonicTimeline, TicksUnit>
impl Instant<MonotonicTimeline, TicksUnit>
Sourcepub fn get() -> Self
pub fn get() -> Self
Read the number of high-precision timer ticks on the monotonic timeline. These ticks may be processor cycles, high speed timer, profiling timer, etc. They do not advance while the system is suspended.
Wraps the zx_ticks_get syscall.
Source§impl Instant<BootTimeline, TicksUnit>
impl Instant<BootTimeline, TicksUnit>
Trait Implementations§
Source§impl<T: Timeline, U: TimeUnit> AddAssign<Duration<T, U>> for Instant<T, U>
impl<T: Timeline, U: TimeUnit> AddAssign<Duration<T, U>> for Instant<T, U>
Source§fn add_assign(&mut self, dur: Duration<T, U>)
fn add_assign(&mut self, dur: Duration<T, U>)
+=
operation. Read moreSource§impl<T, U> Ord for Instant<T, U>
impl<T, U> Ord for Instant<T, U>
Source§impl<T, U> PartialOrd for Instant<T, U>
impl<T, U> PartialOrd for Instant<T, U>
Source§impl<T: Timeline, U: TimeUnit> SubAssign<Duration<T, U>> for Instant<T, U>
impl<T: Timeline, U: TimeUnit> SubAssign<Duration<T, U>> for Instant<T, U>
Source§fn sub_assign(&mut self, dur: Duration<T, U>)
fn sub_assign(&mut self, dur: Duration<T, U>)
-=
operation. Read more