summaryrefslogtreecommitdiffstats
path: root/Lib/logging/handlers.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2007-10-24 10:47:06 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2007-10-24 10:47:06 (GMT)
commitbababa3eccbff2d7c2c8bf3fc5730cf90825d300 (patch)
tree4a8b713634ab0a60d55f1cd54297b3dd86f4c24a /Lib/logging/handlers.py
parent3a8daf5b56fc6c298c30536583a5b903f9a31fb3 (diff)
downloadcpython-bababa3eccbff2d7c2c8bf3fc5730cf90825d300.zip
cpython-bababa3eccbff2d7c2c8bf3fc5730cf90825d300.tar.gz
cpython-bababa3eccbff2d7c2c8bf3fc5730cf90825d300.tar.bz2
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
Diffstat (limited to 'Lib/logging/handlers.py')
-rw-r--r--Lib/logging/handlers.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 9807f13..fa203cf 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -230,11 +230,11 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
# of days in the next week until the rollover day (3).
if when.startswith('W'):
day = t[6] # 0 is Monday
- if day > self.dayOfWeek:
- daysToWait = (day - self.dayOfWeek) - 1
- self.rolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24))
- if day < self.dayOfWeek:
- daysToWait = (6 - self.dayOfWeek) + day
+ if day != self.dayOfWeek:
+ if day < self.dayOfWeek:
+ daysToWait = self.dayOfWeek - day - 1
+ else:
+ daysToWait = 6 - day + self.dayOfWeek
self.rolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24))
#print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime)