Skip to main content

deadline_after_nanoseconds

Function deadline_after_nanoseconds 

Source
pub fn deadline_after_nanoseconds(nanoseconds: u64) -> Instant
Expand description

The Embassy instant at which a wait of nanoseconds has fully elapsed.

embassy_time::Duration::from_nanos adds 999 before dividing, which wraps for huge values (a debug build panics and a release build returns at once), and Timer::after starts from the current tick rounded down, so a wait could end up to a tick early. This rounds the ticks up, adds one tick to every non-zero wait and saturates, so u64::MAX waits practically forever.