Activity log for bug #77588

Date Who What changed Old value New value Message
2007-01-01 01:12:56 James Henstridge bug added bug
2007-01-01 22:08:32 James Henstridge description Western Australia recently adopted daylight saving time, however Bazaar continues to record the time zone of my commits as +0800 even though I've installed the time zone data update and the time is being reported in DST. Looking at the local_time_offset() function in bzrlib.osutils, I see that it is using time.timezone and time.altzone to determine the the offset. However, both of these variables are set to -28800 on my system so it uses +0800 for DST. The implementation of these constants for Linux systems is roughly as follows: 1. take the current time and round it to the start of the year. 2. record the UTC offset for local time at this point 3. record the UTC offset for local time half a year after this point 4. the lower offset is the main time zone and the higher offset is the DST zone. Unfortunately, since we didn't have DST in January 2006 or July 2006, both values are the same. A better implementation for local_time_offset() would be something like this: def local_time_offset(t=None): """Return offset of local zone from GMT, either at present or at time t.""" # python2.3 localtime() can't take None if t is None: t = time.time() local = datetime.datetime(*time.localtime(t)[:6]) utc = datetime.datetime(*time.gmtime(t)[:6]) offset = local - utc return offset.days * 86400 + offset.seconds This should avoid the use of those constants, and give correct results for past or future times that use different rules to the present time. Western Australia recently adopted daylight saving time, however Bazaar continues to record the time zone of my commits as +0800 even though I've installed the time zone data update and the time is being reported in DST. Looking at the local_time_offset() function in bzrlib.osutils, I see that it is using time.timezone and time.altzone to determine the the offset. However, both of these variables are set to -28800 on my system so it uses +0800 for DST. The implementation of these constants for Linux systems is roughly as follows: 1. take the current time and round it to the start of the year. 2. record the UTC offset for local time at this point 3. record the UTC offset for local time half a year after this point 4. the lower offset is the main time zone and the higher offset is the DST zone. Unfortunately, since we didn't have DST in January 2006 or July 2006, both values are the same. A better implementation for local_time_offset() would be something like this: def local_time_offset(t=None): """Return offset of local zone from GMT, either at present or at time t.""" if t is None: t = time.time() local = datetime.datetime.fromtimestamp(t) utc = datetime.datetime.utcfromtimestamp(t) offset = local - utc return offset.days * 86400 + offset.seconds This should avoid the use of those constants, and give correct results for past or future times that use different rules to the present time.
2007-01-03 15:57:50 John A Meinel bzr: status Unconfirmed Fix Committed
2007-01-03 15:57:50 John A Meinel bzr: importance Undecided Medium
2007-01-03 15:57:50 John A Meinel bzr: statusexplanation James has implemented a fix for this, it is pending review and should be in 0.14
2007-01-03 15:57:50 John A Meinel bzr: assignee jamesh
2007-01-05 00:25:19 Alexander Belchenko bzr: status Fix Committed Fix Released
2007-01-05 00:25:19 Alexander Belchenko bzr: statusexplanation James has implemented a fix for this, it is pending review and should be in 0.14 merged in bzr.dev as revno.2222