Subject: | DateTime::Set recurrences broken |
It seems that the recurrence generator is being called twice on every iteration. Witness the following code:
---
#!/usr/bin/perl -w
use DateTime;
use DateTime::Set;
$dts = DateTime::Set->from_recurrence(
next => sub { $_[0]->add(minutes => 1) },
span => DateTime::Span->new(start => DateTime->now),
);
print "\n";
print "ITER:\n";
$iter = $dts->iterator;
my $count = 1;
while ( ($dt = $iter->next) && $count <= 4) {
print "$count: ", $dt->iso8601, "\n";
++$count;
};
---
Produces:
ITER:
1: 2003-04-13T22:05:43
2: 2003-04-13T22:07:42
3: 2003-04-13T22:09:41
4: 2003-04-13T22:11:40
---
Notice how we're only getting every other minute. Also, why are the seconds drifting down?
Thanks,
Matt