Skip to content

Commit

Permalink
Make sure that old events are removed properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeresig committed Dec 22, 2010
1 parent 55c3957 commit 887265a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wtpa-bot.pl
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ sub tick {

# Get the current day of the year for comparison
my $now = DateTime->from_epoch( epoch => time(), time_zone => $TZ );
my $cur = $now->doy() || 367;
my $cur = $now->doy();
my $remove = 0;

# Go through all the events
Expand All @@ -333,7 +333,7 @@ sub tick {
my $day = $when->doy();

# If the event day is old we need to remove it
if ( $day < $cur ) {
if ( time() > $events[$i]->{when} && $day != $cur ) {
print STDERR "Cleaning up $events[$i]->{name}\n";

# Remove the event (but don't remove the calendar entry)
Expand Down

0 comments on commit 887265a

Please sign in to comment.