Skip to main content

Instant

Type Alias Instant 

Source
pub type Instant = Instant;
Expand description

The instant sleep_until measures deadlines against — the backend’s own clock, which is the whole point of naming it here.

A deadline is only meaningful in the clock the timer that waits on it runs on. The hosted timer is tokio’s, and under #[tokio::test(start_paused = true)] tokio’s clock is virtual and advances on sleep, not with the wall — so a std::time::Instant deadline handed to a tokio timer is a deadline in a different timeline, and the wait is wrong by however far the two have diverged. The RTEMS timer runs on std::time::Instant (1-second-quantized on target, doc/calink-rtems-design.md §5.5).

Taking the alias rather than a concrete instant type is what keeps a caller from mixing them: Instant::now() + timeout is the deadline sleep_until will actually honour, on both backends.

Aliased Type§

pub struct Instant { /* private fields */ }