[Python-checkins] r42064 - python/trunk/Lib/logging/handlers.py
vinay.sajip
python-checkins at python.org
Mon Jan 16 10:08:10 CET 2006
Author: vinay.sajip
Date: Mon Jan 16 10:08:06 2006
New Revision: 42064
Modified:
python/trunk/Lib/logging/handlers.py
Log:
Fixed bug in time-to-midnight calculation.
Modified: python/trunk/Lib/logging/handlers.py
==============================================================================
--- python/trunk/Lib/logging/handlers.py (original)
+++ python/trunk/Lib/logging/handlers.py Mon Jan 16 10:08:06 2006
@@ -212,9 +212,12 @@
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
More information about the Python-checkins
mailing list