summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/iter.rs7
-rw-r--r--src/iterinfo.rs4
-rw-r--r--tests/rrule.rs31
3 files changed, 40 insertions, 2 deletions
diff --git a/src/iter.rs b/src/iter.rs
index 561585e..dd1066a 100644
--- a/src/iter.rs
+++ b/src/iter.rs
@@ -106,8 +106,10 @@ pub fn iter(iter_result: &mut IterResult, options: &mut ParsedOptions) -> Vec<Da
Some(count) => count,
_ => 0,
};
+ println!("Timeset: {:?}", timeset);
loop {
+ println!("Counter date in loop: {}", counter_date);
let (dayset, start, end) = ii.getdayset(
&options.freq,
counter_date.year() as isize,
@@ -186,7 +188,9 @@ pub fn iter(iter_result: &mut IterResult, options: &mut ParsedOptions) -> Vec<Da
}
// Handle frequency and interval
+ println!("Before counter add: {}", counter_date);
counter_date = increment_counter_date(counter_date, options, filtered);
+ println!("After counter add: {}", counter_date);
if counter_date.year() > 2200 {
return iter_result.get_value();
@@ -196,6 +200,7 @@ pub fn iter(iter_result: &mut IterResult, options: &mut ParsedOptions) -> Vec<Da
|| options.freq == Frequenzy::MINUTELY
|| options.freq == Frequenzy::SECONDLY
{
+ println!("Getting timeset for counter date: {:?}", counter_date);
timeset = ii.gettimeset(
&options.freq,
counter_date.hour() as usize,
@@ -252,6 +257,7 @@ pub fn increment_counter_date(
Frequenzy::HOURLY => {
let mut new_hours = counter_date.hour() as usize;
if filtered {
+ println!("yeaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah");
new_hours += ((23 - new_hours) as f32 / options.interval as f32).floor() as usize
* options.interval;
}
@@ -264,6 +270,7 @@ pub fn increment_counter_date(
.iter()
.any(|bh| *bh == (new_hours % 24) as usize)
{
+ println!("Broke at new hours: {}", new_hours);
break;
}
}
diff --git a/src/iterinfo.rs b/src/iterinfo.rs
index 083d4fa..18020d5 100644
--- a/src/iterinfo.rs
+++ b/src/iterinfo.rs
@@ -182,7 +182,7 @@ impl<'a> IterInfo<'a> {
.map(|minute| self.mtimeset(hour, *minute, second, millisecond))
.flatten()
.collect::<Vec<Time>>();
- set.sort_by_key(|a| -1 * (a.time() as isize));
+ set.sort_by_key(|a| a.time());
set
}
@@ -193,7 +193,7 @@ impl<'a> IterInfo<'a> {
.iter()
.map(|second| Time::new(hour, minute, *second, millisecond))
.collect::<Vec<Time>>();
- set.sort_by_key(|a| -1 * (a.time() as isize));
+ set.sort_by_key(|a| a.time());
set
}
diff --git a/tests/rrule.rs b/tests/rrule.rs
index 5d73eeb..745577a 100644
--- a/tests/rrule.rs
+++ b/tests/rrule.rs
@@ -4172,4 +4172,35 @@ mod test {
],
);
}
+ #[test]
+ fn hourly_by_minute() {
+ let mut options = ParsedOptions {
+ freq: Frequenzy::HOURLY,
+ count: Some(3),
+ bymonth: vec![],
+ dtstart: ymd_hms(1997, 9, 2, 9, 0, 0),
+ byweekday: vec![],
+ byhour: vec![],
+ bysetpos: vec![],
+ byweekno: vec![],
+ byminute: vec![6, 18],
+ bysecond: vec![0],
+ byyearday: vec![],
+ bymonthday: vec![],
+ bynweekday: vec![],
+ bynmonthday: vec![],
+ until: None,
+ wkst: 0,
+ tzid: None,
+ interval: 1,
+ };
+ test_recurring(
+ &mut options,
+ &vec![
+ ymd_hms(1997, 9, 2, 9, 6, 0),
+ ymd_hms(1997, 9, 2, 9, 18, 0),
+ ymd_hms(1997, 9, 2, 10, 6, 0),
+ ],
+ );
+ }
}