diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2006-01-16 09:08:06 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2006-01-16 09:08:06 (GMT) |
commit | 74a83e9ffbee00288bbc1ddd0e5a40e84a03b4af (patch) | |
tree | e9495bc2e12a68be352075070d9cfa0829ceea27 /Lib | |
parent | b8967599319c626d2cdcd11c0cef7305fe98ca73 (diff) | |
download | cpython-74a83e9ffbee00288bbc1ddd0e5a40e84a03b4af.zip cpython-74a83e9ffbee00288bbc1ddd0e5a40e84a03b4af.tar.gz cpython-74a83e9ffbee00288bbc1ddd0e5a40e84a03b4af.tar.bz2 |
Fixed bug in time-to-midnight calculation.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/logging/handlers.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 1ec9afc..6225f17 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 |