- my $offset = $opt{'offset'} || 0;
- # Always use $offset - 1day + 1sec = the last second of that day
- my $cutoff = DateTime->now->set(hour => 23, minute => 59, second => 59);
- $cutoff->subtract(days => $offset);
-
- my $start = $cutoff->clone;
- $start->subtract(days => $startdays);
-
- my $end = $cutoff->clone;
- $end->subtract(days => $enddays);
-
- #warn "offset $offset (".$cutoff->epoch."), range $startdays-$enddays (".$start->epoch . '-' . ($enddays ? $end->epoch : '').")\n";
- my $sql = &{$range_sub}( $start->epoch,
- $enddays ? $end->epoch : '',
- $cutoff->epoch ); #%opt?