Message60113
I did not put suggested code in - walking through it and counting days
on my fingers I don't think it works.
If the desired rollover day is Tuesday (self.dayOfWeek = 1) and today
is Tuesday (day = 1) then self.rolloverAt is the seconds to midnight as
if daysToWait =0, and it rolls over at midnight Tuesday. However if
the desired rollover day is Tuesday (self.dayOfWeek = 1) and today is
Monday (day = 0) then daysToWait = 0 again. It rolls over on Monday at
midnight - not Tuesday at midnight.
If the desired rollover day is Tuesday (self.dayOfWeek = 1) and today
is Wednesday (day = 2) then daysToWait = 5. It also rolls over on
Monday at midnight - not Tuesday at midnight.
Changing it to:
day = t[6] # 0 is Monday
if day != self.dayOfWeek:
if day < self.dayOfWeek:
daysToWait = self.dayOfWeek - day
else:
daysToWait = 6 - day + self.dayOfWeek + 1
would make it equivalent to what I have running and appears to work.
(Always rolls (ends) on day specified at midnight.)
Alternatively, if you wanted to change it so the log starts on the day
specified you could just get rid of "if day != self.dayOfWeek:" from
your code.
if when.startswith('W'):
day = t[6] # 0 is Monday
if day < self.dayOfWeek:
daysToWait = self.dayOfWeek - day - 1
else:
daysToWait = 6 - day + self.dayOfWeek
self.rolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24)) |
|
Date |
User |
Action |
Args |
2008-01-18 20:30:29 | kmk | set | spambayes_score: 0.368251 -> 0.36825085 recipients:
+ kmk, vinay.sajip |
2008-01-18 20:30:29 | kmk | set | spambayes_score: 0.368251 -> 0.368251 messageid: <1200688229.36.0.742916234287.issue1836@psf.upfronthosting.co.za> |
2008-01-18 20:30:28 | kmk | link | issue1836 messages |
2008-01-18 20:30:27 | kmk | create | |
|