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> PartialOrd for Instant<T, U>
impl<T, U> PartialOrd for Instant<T, U>
Source§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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)