accept now_mins_west for v2 legacy timing as well

This commit is contained in:
Damien Elmes 2020-03-22 17:33:14 +10:00
parent 6c6817563e
commit 25ff4642ec

View file

@ -144,19 +144,18 @@ pub(crate) fn sched_timing_today(
now_mins_west: Option<i32>,
rollover_hour: Option<i8>,
) -> SchedTimingToday {
let now_west = now_mins_west.unwrap_or_else(|| local_minutes_west_for_stamp(now_secs));
match (rollover_hour, created_mins_west) {
(None, _) => {
// if rollover unset, v1 scheduler
sched_timing_today_v1(created_secs, now_secs)
}
(Some(roll), None) => {
// if creation offset unset, v2 legacy cutoff using local timezone
let offset = local_minutes_west_for_stamp(now_secs);
sched_timing_today_v2_legacy(created_secs, roll, now_secs, offset)
// if creationOffset unset, v2 scheduler with legacy cutoff handling
sched_timing_today_v2_legacy(created_secs, roll, now_secs, now_west)
}
(Some(roll), Some(crt_west)) => {
// new cutoff code, using provided current timezone, falling back on local timezone
let now_west = now_mins_west.unwrap_or_else(|| local_minutes_west_for_stamp(now_secs));
// v2 scheduler, new cutoff handling
sched_timing_today_v2_new(created_secs, crt_west, now_secs, now_west, roll)
}
}