pub struct WallClock<'wc, T, S>{ /* private fields */ }
Implementations§
source§impl<T, S> WallClock<'_, T, S>
impl<T, S> WallClock<'_, T, S>
sourcepub fn using<OT: Into<OwnOrBorrowMut<'static, T>>>(timer: OT) -> Self
pub fn using<OT: Into<OwnOrBorrowMut<'static, T>>>(timer: OT) -> Self
Create an instance that will use the given RTC timer device for timing.
sourcepub fn static_using<OT: Into<OwnOrBorrowMut<'static, T>>>(
timer: OT
) -> &'static mut Self
pub fn static_using<OT: Into<OwnOrBorrowMut<'static, T>>>( timer: OT ) -> &'static mut Self
Return a static reference to an instance that will use the given RTC device for timing.
pub fn with_timer(timer: &'static mut T) -> Self
pub fn static_with_timer(timer: &'static mut T) -> &'static mut Self
sourcepub fn runtime(&self) -> Duration
pub fn runtime(&self) -> Duration
Return the total duration for which the clock has been running
sourcepub fn runtime_overflowed(&self) -> bool
pub fn runtime_overflowed(&self) -> bool
Return true iff the runtime counter has overflowed
sourcepub fn clear_runtime_overflow(&mut self)
pub fn clear_runtime_overflow(&mut self)
Clear the flag indicating that the runtime counter overflowed (until the next time…)
sourcepub fn wait(&self, delay: Duration)
pub fn wait(&self, delay: Duration)
Block the calling thread for (at least) the given duration.
§Important
Note that the clock must be running -
i.e. the supervisor.listen_handle()
method was called already - before
you use the wait()
method, or you can expect to block forever, , and that
this method depends on the main supervisor to be running. In other words,
this must be used in threads you have spawn()
ed, not the main thread.
Trait Implementations§
source§impl<'wc, T, S> DelayEvents<'wc> for WallClock<'wc, T, S>
impl<'wc, T, S> DelayEvents<'wc> for WallClock<'wc, T, S>
type DelayHandle = DelayQueueHandle
source§fn after_delay(
&self,
delay: Duration,
bf: Box<dyn DelayCallback + 'wc>
) -> Self::DelayHandle
fn after_delay( &self, delay: Duration, bf: Box<dyn DelayCallback + 'wc> ) -> Self::DelayHandle
delay
time has passed.source§fn cancel_delay(&self, handle: Self::DelayHandle) -> bool
fn cancel_delay(&self, handle: Self::DelayHandle) -> bool
true
if the event
was cancelled, or false
if not (because it either never existed,
or it has already been executed.)source§impl<T, S> EventSource for WallClock<'_, T, S>
impl<T, S> EventSource for WallClock<'_, T, S>
source§fn process_event(&self, evt: OxideEvent)
fn process_event(&self, evt: OxideEvent)
Process the clock events (in userland). This means calling any explicit on-event handlers, but we also do the processing of any delay queue events entirely in userland.