expression

Keep periodic releases anchored to a schedule

Scheduling the next release from the prior scheduled release avoids accumulating execution-time drift. This example calculates the first future release on a fixed time grid after a delay, explicitly skipping missed releases. It assumes nonwrapping u64 ticks and does not guarantee deadline satisfaction. Expected host stdout (not executed): next: Some(130) invalid: None Common mistake: Scheduling each period from task completion and accumulating drift, or hiding the policy for missed releases.

Formal Syntax & Structure

rust syntaxrust
next_release.checked_add(period)

Working Example

Example Snippetrust
#![no_std]pub fn next_after(previous: u64, period: u64, now: u64) -> Option<u64> {    if period == 0 || now < previous { return None; }    let steps = ((now - previous) / period).checked_add(1)?;    previous.checked_add(steps.checked_mul(period)?)}
Rust Reference