[Python-checkins] r58628 - python/trunk/Lib/logging/handlers.py

vinay.sajip python-checkins at python.org
Wed Oct 24 12:47:06 CEST 2007


Author: vinay.sajip
Date: Wed Oct 24 12:47:06 2007
New Revision: 58628

Modified:
   python/trunk/Lib/logging/handlers.py
Log:
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()

Modified: python/trunk/Lib/logging/handlers.py
==============================================================================
--- python/trunk/Lib/logging/handlers.py	(original)
+++ python/trunk/Lib/logging/handlers.py	Wed Oct 24 12:47:06 2007
@@ -230,11 +230,11 @@
             #         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)


More information about the Python-checkins mailing list