[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>.
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