This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kmk
Recipients kmk, vinay.sajip
Date 2008-01-18.20:30:27
SpamBayes Score 0.36825085
Marked as misclassified No
Message-id <1200688229.36.0.742916234287.issue1836@psf.upfronthosting.co.za>
In-reply-to
Content
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))
History
Date User Action Args
2008-01-18 20:30:29kmksetspambayes_score: 0.368251 -> 0.36825085
recipients: + kmk, vinay.sajip
2008-01-18 20:30:29kmksetspambayes_score: 0.368251 -> 0.368251
messageid: <1200688229.36.0.742916234287.issue1836@psf.upfronthosting.co.za>
2008-01-18 20:30:28kmklinkissue1836 messages
2008-01-18 20:30:27kmkcreate