openzeppelin_monitor::utils

Function get_cron_interval_ms

Source
pub fn get_cron_interval_ms(cron_schedule: &str) -> Option<i64>
Expand description

Calculates the time interval between two consecutive occurrences of a cron schedule

This function takes a cron expression and determines how many milliseconds will elapse between two consecutive runs of the schedule.

§Arguments

  • cron_schedule - A string slice containing a valid cron expression (e.g., “0 0 * * *”)

§Returns

  • Some(i64) - The number of milliseconds between consecutive schedule runs
  • None - If the cron expression is invalid or if two consecutive occurrences cannot be determined