Skip to main content

interval_break_due

Function interval_break_due 

Source
pub fn interval_break_due(
    enabled: bool,
    mode_includes_interval: bool,
    last_fire: Instant,
    interval_secs: u64,
    idle_suppressed: bool,
    now: Instant,
) -> bool
Expand description

True iff an interval-mode break of this kind is due to fire now.

All inputs are explicit so callers can drive it with a synthetic Instant in tests. now.saturating_duration_since(last_fire) mirrors the production check last_fire.elapsed() with a frozen clock.

mode_includes_interval is the de-stringified equivalent of the settings’s *_schedule_mode ∈ {"interval", "both"} — done at the call site so this stays clock-agnostic.