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() -> Instant<MonotonicTimeline>
pub fn get() -> Instant<MonotonicTimeline>
Get the current monotonic time which does not advance during system suspend.
Wraps the zx_clock_get_monotonic syscall.
sourcepub fn after(
duration: Duration<MonotonicTimeline>,
) -> Instant<MonotonicTimeline>
pub fn after( duration: Duration<MonotonicTimeline>, ) -> Instant<MonotonicTimeline>
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 get() -> Instant<BootTimeline>
pub fn get() -> Instant<BootTimeline>
Get the current boot time which advances during system suspend.
sourcepub fn after(duration: Duration<BootTimeline>) -> Instant<BootTimeline>
pub fn after(duration: Duration<BootTimeline>) -> Instant<BootTimeline>
Compute a deadline for the time in the future that is the given Duration
away.
source§impl<T> Instant<T>where
T: Timeline,
impl<T> Instant<T>where
T: Timeline,
pub const INFINITE: Instant<T> = _
pub const INFINITE_PAST: Instant<T> = _
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) -> Instant<T>
pub const fn from_nanos(nanos: i64) -> Instant<T>
Return a strongly-typed Time
from a raw number of nanoseconds.
source§impl Instant<MonotonicTimeline, TicksUnit>
impl Instant<MonotonicTimeline, TicksUnit>
sourcepub fn get() -> Instant<MonotonicTimeline, TicksUnit>
pub fn get() -> Instant<MonotonicTimeline, TicksUnit>
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>
sourcepub fn get() -> Instant<BootTimeline, TicksUnit>
pub fn get() -> Instant<BootTimeline, TicksUnit>
Read the number of high-precision timer ticks on the boot timeline. These ticks may be processor cycles, high speed timer, profiling timer, etc. They advance while the system is suspended.
source§impl<T> Instant<T, TicksUnit>where
T: Timeline,
impl<T> Instant<T, TicksUnit>where
T: Timeline,
sourcepub const fn from_raw(raw: i64) -> Instant<T, TicksUnit>
pub const fn from_raw(raw: i64) -> Instant<T, TicksUnit>
Return a strongly-typed Ticks
from a raw number of system ticks.
sourcepub fn per_second() -> i64
pub fn per_second() -> i64
Return the number of high-precision timer ticks in a second.
Wraps the zx_ticks_per_second syscall.
Trait Implementations§
source§impl<T, U> AddAssign<Duration<T, U>> for Instant<T, U>
impl<T, U> 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: Timeline + 'static, D: ResourceDialect> Decode<Instant<T>, D> for Instant<T>
impl<T: Timeline + 'static, D: ResourceDialect> Decode<Instant<T>, D> for Instant<T>
source§impl<T: Timeline + 'static, D: ResourceDialect> Decode<Instant<T, TicksUnit>, D> for Ticks<T>
impl<T: Timeline + 'static, D: ResourceDialect> Decode<Instant<T, TicksUnit>, D> for Ticks<T>
source§impl<T: Timeline + 'static, D: ResourceDialect> Encode<Instant<T, TicksUnit>, D> for Ticks<T>
impl<T: Timeline + 'static, D: ResourceDialect> Encode<Instant<T, TicksUnit>, D> for Ticks<T>
§impl From<BootInstant> for Instant<BootTimeline>
impl From<BootInstant> for Instant<BootTimeline>
§fn from(t: BootInstant) -> Instant<BootTimeline>
fn from(t: BootInstant) -> Instant<BootTimeline>
§impl From<MonotonicInstant> for Instant<MonotonicTimeline>
impl From<MonotonicInstant> for Instant<MonotonicTimeline>
§fn from(t: MonotonicInstant) -> Instant<MonotonicTimeline>
fn from(t: MonotonicInstant) -> Instant<MonotonicTimeline>
source§impl<T, U> Ord for Instant<T, U>
impl<T, U> Ord for Instant<T, U>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<T, U> PartialEq for Instant<T, U>
impl<T, U> PartialEq for Instant<T, U>
source§impl<T, U> PartialOrd for Instant<T, U>
impl<T, U> PartialOrd for Instant<T, U>
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<T, U> SubAssign<Duration<T, U>> for Instant<T, U>
impl<T, U> 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 moresource§impl<T: Timeline + 'static, U: 'static> TypeMarker for Instant<T, U>
impl<T: Timeline + 'static, U: 'static> TypeMarker for Instant<T, U>
source§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
source§fn inline_size(_context: Context) -> usize
fn inline_size(_context: Context) -> usize
inline_align
.source§fn encode_is_copy() -> bool
fn encode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and encoding requires no validation. When true, we can optimize
encoding arrays and vectors of Self::Owned
to a single memcpy. Read moresource§fn decode_is_copy() -> bool
fn decode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and decoding requires no validation. When true, we can optimize
decoding arrays and vectors of Self::Owned
to a single memcpy.§impl WakeupTime for Instant<BootTimeline>
impl WakeupTime for Instant<BootTimeline>
§fn into_timer(self) -> Timer
fn into_timer(self) -> Timer
§impl WakeupTime for Instant<MonotonicTimeline>
impl WakeupTime for Instant<MonotonicTimeline>
§fn into_timer(self) -> Timer
fn into_timer(self) -> Timer
impl<T, U> Copy for Instant<T, U>
impl<T, U> Eq for Instant<T, U>
Auto Trait Implementations§
impl<T, U> Freeze for Instant<T, U>
impl<T, U> RefUnwindSafe for Instant<T, U>where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for Instant<T, U>
impl<T, U> Sync for Instant<T, U>
impl<T, U> Unpin for Instant<T, U>
impl<T, U> UnwindSafe for Instant<T, U>where
T: UnwindSafe,
U: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)