[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>. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com