pub trait Clock {
// Required method
fn now_ms(&self) -> u64;
// Provided method
fn poll_delay_until(
&self,
cx: &mut Context<'_>,
deadline_ms: u64,
) -> Poll<()> { ... }
}Expand description
Monotonic millisecond clock.
Required Methods§
Provided Methods§
Sourcefn poll_delay_until(&self, cx: &mut Context<'_>, deadline_ms: u64) -> Poll<()>
fn poll_delay_until(&self, cx: &mut Context<'_>, deadline_ms: u64) -> Poll<()>
Poll a delay that completes when the monotonic clock reaches deadline_ms.
Returns Poll::Ready(()) if the deadline has already passed. Otherwise
the implementation should register cx.waker() with a platform timer and
return Poll::Pending.
The default implementation returns Ready(()) immediately, which causes
callers to busy-poll on timer deadlines. Platform clocks backed by a
real timer (tokio, embassy, etc.) should override this.