cron icon indicating copy to clipboard operation
cron copied to clipboard

Schedule::after doesn't take milliseconds into account

Open canac opened this issue 2 years ago • 0 comments

This is a fantastic crate! However, I'm running into some issues because it seems that Schedule::after doesn't take milliseconds into account. This shows up when iterating over the upcoming times in reverse order to get previous times.

let schedule = Schedule::from_str("* * * * * * *").unwrap();
let start_time = Utc.ymd(2022, 1, 1).and_hms_milli(12, 0, 0, 500);
println!("{}", schedule.after(&start_time).rev().next().unwrap());

I would expect this code to print "2022-01-01 12:00:00 UTC", but it prints "2022-01-01 11:59:59 UTC" instead.

canac avatar Aug 07 '22 02:08 canac