Ticket #2404 (closed defect: fixed)
DST calculation problem in log.py/FileLogObserver.getTimezoneOffset
| Reported by: | thor | Owned by: | exarkun |
|---|---|---|---|
| Priority: | highest | Milestone: | |
| Component: | core | Keywords: | regression |
| Cc: | thor, exarkun, itamarst, jknight | Branch: | |
| Author: | Launchpad Bug: |
Description
getTimezoneOffset uses Python's "time.daylight" to determine whether or not localtime currently needs to be adjusted by DST rules, but time.daylight indicates just that the local time zone uses DST at all, not that it should be used at the moment, thus getTimezoneOffset always returns the DST offset even in winter (i.e. now in the northern hemisphere) resulting in a local time that is off by 1 hour for me at the moment (CEST instead of CET is used).
Cf. http://docs.python.org/lib/module-time.html , the Python src code (Modules/timemodule.c) and the following from log.py
def getTimezoneOffset(self):
""" Return the current local timezone offset from UTC.
@rtype: C{int} @return: The number of seconds offset from UTC. West is positive, east is negative. """
if time.daylight:
return time.altzone
return time.timezone
