summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-10-18 09:15:08 +0200
committerYorhel <git@yorhel.nl>2009-10-18 09:15:08 +0200
commitee96a4381fa187eede8374601d0c06cd861eb66c (patch)
tree1f2856a6bbbfa6debf60c461a1cc4ec0e236fbd8 /lib
parent668833467f8231ebdc622d42edcb49e8374b42b4 (diff)
Multi::Maintenance: Fixed bug with cron jobs running more than once
Diffstat (limited to 'lib')
-rw-r--r--lib/Multi/Maintenance.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Multi/Maintenance.pm b/lib/Multi/Maintenance.pm
index 423def75..59d30ce6 100644
--- a/lib/Multi/Maintenance.pm
+++ b/lib/Multi/Maintenance.pm
@@ -50,7 +50,7 @@ sub set_daily {
# (GMT because we're calculating on the UNIX timestamp, I can easily add an
# offset if necessary, but it doesn't really matter what time this cron
# runs, as long as it's run on a daily basis)
- $_[KERNEL]->alarm(daily => int(time/86400+1)*86400);
+ $_[KERNEL]->alarm(daily => int((time+3)/86400+1)*86400);
}
@@ -70,7 +70,7 @@ sub set_monthly {
# We do this by simply incrementing the timestamp with one day and checking gmtime()
# for a month change. This might not be very reliable, but should be enough for
# our purposes.
- my $nextday = int(time/86400+1)*86400;
+ my $nextday = int((time+3)/86400+1)*86400;
my $thismonth = (gmtime)[5]*100+(gmtime)[4]; # year*100 + month, for easy comparing
$nextday += 86400 while (gmtime $nextday)[5]*100+(gmtime $nextday)[4] <= $thismonth;
$_[KERNEL]->alarm(monthly => $nextday);