Skip to main content

validate_and_prepare_timer

Function validate_and_prepare_timer 

Source
pub fn validate_and_prepare_timer(
    name: &str,
    interval_ns: u64,
    start_time_ns: Option<UnixNanos>,
    stop_time_ns: Option<UnixNanos>,
    allow_past: Option<bool>,
    fire_immediately: Option<bool>,
    ts_now: UnixNanos,
) -> Result<(Ustr, UnixNanos, Option<UnixNanos>, bool, bool)>
Expand description

Validates and normalizes parameters for an interval timer.

A missing or zero start_time_ns resolves to ts_now. allow_past defaults to true, and fire_immediately defaults to false. Returns the interned name, normalized start and stop times, and resolved flag values.

ยงErrors

Returns an error if:

  • name is invalid.
  • interval_ns is zero.
  • start_time_ns + interval_ns is out of range for UnixNanos when not firing immediately.
  • The first event is in the past when past times are disallowed.
  • The stop time is not after the normalized start time.
  • The stop time is not after ts_now when past times are disallowed.