the ~ubuntu-branches import makes wrong timestamps (time zone mess)

Bug #475983 reported by Tormod Volden
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
brz-debian
Triaged
Medium
Unassigned
bzr-builddeb
Confirmed
Medium
Unassigned

Bug Description

Example:
http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/karmic/mesa/karmic/revision/96
The debian/changelog says "Tue, 13 Oct 2009 13:48:03 -0700".
The web interface says just "2009-10-13 14:48:03" which could be my local time (UTC+1) if the changelog date is mistaken as UTC by dropping the -0700.

Branching the repo, bzr log says "timestamp: Tue 2009-10-13 06:48:03 -0700" which is definitely wrong. So it seems it parses the changelog date as UTC ignoring the -0700, but still writes out the now wrong date in the original -0700 format.

James Westby (james-w)
affects: launchpad → bzr-builddeb
Changed in bzr-builddeb:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Anders Kaseorg (andersk) wrote :

The relevant code from import_dsc.py is indeed confused:

            if use_time_from_changelog and len(cl._blocks) > 0:
                 raw_timestamp = cl.date
                 import rfc822, time
                 time_tuple = rfc822.parsedate_tz(raw_timestamp)
                 if time_tuple is not None:
                     timestamp = (time.mktime(time_tuple[:9]), time_tuple[9])
                 author = safe_decode(cl.author)

time.mktime works in the system’s local time zone, which in general is different from the changelog entry’s time zone. The correct calculation is

timestamp = (calendar.timegm(time_tuple[:9]) - time_tuple[9], time_tuple[9])

Revision history for this message
Anders Kaseorg (andersk) wrote :

(Alternatively, this is what rfc822.mktime_tz is for, but that has a DST-related bug <http://bugs.python.org/issue14653> which was fixed in Python 3.2.4rc1 by making it work exactly how I just described.)

Jelmer Vernooij (jelmer)
Changed in brz-debian:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.