Loggerhead is time zone-naive

Bug #376842 reported by Matt Nordhoff
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
loggerhead
Fix Released
Low
Robert Collins

Bug Description

The few places I see Loggerhead use the datetime module, it uses datetime.datetime.fromtimestamp(some_utc_timestamp), which creates an object that uses the local time zone but doesn't know it. It's usually okay to have Loggerhead display times in local time with no time zone information, but the Atom feed needs to be aware of time zones, and that information is just not available from a "change" object.

What do you want to do? Least invasive would be adding "utc_date" and/or "timezone" attributes to "change" objects, but maybe it would be better to use UTC or the revisions' original time zones everywhere. Or continue using local time, but show the time zone in the UI. Or something; I dunno.

(By "change" objects I mean those returned by loggerhead.history.History.get_changes() and passed around everywhere.)

(Time zones and "datetime" make me want to bang my head on a wall.)

Edit: I meant to add, I don't know how much of the code base is effected by this, since, well, grepping for "datetime" only returns 3 results, but "time" returns...a lot more. :P Any solution may need to apply to other things as well.

description: updated
description: updated
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

It would be good to be less naive here.

I guess local-timezone-by-default and a --utc option would perhaps make sense?

I share the desire to bang my head on a wall when I think too hard about all this stuff though.

Revision history for this message
Martin Albisetti (beuno) wrote :

local-timezone-by-default and a --utc sounds great

Changed in loggerhead:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Matt Nordhoff (mnordhoff) wrote : Re: [Bug 376842] Re: Loggerhead is time zone-naive

I don't really care about the UI. :-P The reason I filed the bug is that
the Atom UI needs to know a revision's commit time in UTC, and that's
not available.

Revision history for this message
Matt Nordhoff (mnordhoff) wrote :

Well, Atom doesn't specifically need UTC, it just needs time + time zone. Nonetheless, that isn't available.

(I'm going to work around this the easiest, least-invasive and somewhat hacky way by adding a "utc_date" attribute.)

Revision history for this message
Robert Collins (lifeless) wrote :

So, this should be fixed, as the utc_date attribute is now used pretty consistently.

Revision history for this message
Robert Collins (lifeless) wrote :

If not, please reopen.

Changed in loggerhead:
status: Triaged → Fix Committed
assignee: nobody → Robert Collins (lifeless)
Changed in loggerhead:
status: Fix Committed → Fix Released
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.