diff options
Diffstat (limited to 'src/iter/mod.rs')
-rw-r--r-- | src/iter/mod.rs | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/iter/mod.rs b/src/iter/mod.rs index c9fa858..5e6e4d1 100644 --- a/src/iter/mod.rs +++ b/src/iter/mod.rs @@ -6,7 +6,6 @@ mod poslist; use poslist::build_poslist; mod easter; mod masks; -mod utils; use crate::datetime::{from_ordinal, get_weekday_val, DTime, Time}; use crate::options::*; @@ -210,24 +209,26 @@ pub fn increment_counter_date( let hours = counter_date.hour() as usize; if filtered { // Jump to one iteration before next day - minutes_inc = (1439. - ((hours*60+minutes) as f32/options.interval as f32)).floor() as usize *options.interval; + minutes_inc = (1439. - ((hours * 60 + minutes) as f32 / options.interval as f32)) + .floor() as usize + * options.interval; } - let mut counter_date = counter_date + Duration::minutes(minutes_inc as i64); loop { counter_date = counter_date + Duration::minutes(options.interval as i64); let minutes = counter_date.minute() as usize; let hours = counter_date.hour() as usize; - if (options.byhour.is_empty() || includes(&options.byhour, &hours)) && ( - options.byminute.is_empty() || includes(&options.byminute, &minutes)) { - break; + if (options.byhour.is_empty() || includes(&options.byhour, &hours)) + && (options.byminute.is_empty() || includes(&options.byminute, &minutes)) + { + break; } } counter_date - }, + } Frequenzy::Secondly => { let mut seconds_inc = 0; let seconds = counter_date.second() as usize; @@ -235,10 +236,12 @@ pub fn increment_counter_date( let hours = counter_date.hour() as usize; if filtered { // Jump to one iteration before next day - seconds_inc = (86399. - ((hours*3600+minutes*60+seconds) as f32/options.interval as f32)).floor() as usize *options.interval; + seconds_inc = (86399. + - ((hours * 3600 + minutes * 60 + seconds) as f32 / options.interval as f32)) + .floor() as usize + * options.interval; } - let mut counter_date = counter_date + Duration::seconds(seconds_inc as i64); loop { counter_date = counter_date + Duration::seconds(options.interval as i64); @@ -246,16 +249,16 @@ pub fn increment_counter_date( let minutes = counter_date.minute() as usize; let hours = counter_date.hour() as usize; - if (options.byhour.is_empty() || includes(&options.byhour, &hours)) && ( - options.byminute.is_empty() || includes(&options.byminute, &minutes)) && ( - options.bysecond.is_empty() || includes(&options.bysecond, &seconds) - ) { - break; + if (options.byhour.is_empty() || includes(&options.byhour, &hours)) + && (options.byminute.is_empty() || includes(&options.byminute, &minutes)) + && (options.bysecond.is_empty() || includes(&options.bysecond, &seconds)) + { + break; } } counter_date - }, + } } } |