summaryrefslogtreecommitdiff
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2006-01-16 09:08:06 +0000
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2006-01-16 09:08:06 +0000
commit8cdbdfad9700c1f2e07d1aa63e13cf1fe674bd01 (patch)
tree8e78094b5432963bd8e39096dbbc6bffe2acee37 /Lib/logging
parent198cec2f447ffa28fae30e76b00e502fb2b68d48 (diff)
downloadcpython-8cdbdfad9700c1f2e07d1aa63e13cf1fe674bd01.tar.gz
Fixed bug in time-to-midnight calculation.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/handlers.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 1ec9afcdc3..6225f17f96 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -212,9 +212,12 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
currentMinute = t[4]
currentSecond = t[5]
# r is the number of seconds left between now and midnight
- r = (24 - currentHour) * 60 * 60 # number of hours in seconds
- r = r + (59 - currentMinute) * 60 # plus the number of minutes (in secs)
- r = r + (59 - currentSecond) # plus the number of seconds
+ if (currentMinute == 0) and (currentSecond == 0):
+ r = (24 - currentHour) * 60 * 60 # number of hours in seconds
+ else:
+ r = (23 - currentHour) * 60 * 60
+ r = r + (59 - currentMinute) * 60 # plus the number of minutes (in secs)
+ r = r + (60 - currentSecond) # plus the number of seconds
self.rolloverAt = currentTime + r
# If we are rolling over on a certain day, add in the number of days until
# the next rollover, but offset by 1 since we just calculated the time