A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2006-January/059777.html below:

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

[Python-Dev] [Python-checkins] r42064 - python/trunk/Lib/logging/handlers.py [Python-Dev] [Python-checkins] r42064 - python/trunk/Lib/logging/handlers.pyTim Peters tim.peters at gmail.com
Mon Jan 16 17:09:20 CET 2006
[vinay]
>> Log:
>>   Fixed bug in time-to-midnight calculation.

[Skip]
> Is there some reason not to use datetime to do this?

PEP 291 says logging intends to be compatible with Python 1.5.2, which
leaves datetime out.

Vinay, rather than:

    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) # pl

for clarity I suggest this instead:

# A module-level constant
_MIDNIGHT = 24 * 60 * 60  # number of seconds in a day

    r = _MIDNIGHT - ((currentHour * 60 + currentMinute) * 60 + currentSecond)

That's "obviously correct" instead of "huh?" <wink>.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4