Why timestamp + timezone rather than date stamp

John A Meinel john at arbash-meinel.com
Thu Jun 30 19:19:28 BST 2005

I'm just wondering why Revision entries store the local timestamp
(seconds since epoch) plus the local offset in seconds relative to GMT,
rather than either storing a datestamp or a GMT timestamp, and then some
information about what timezone it was committed in.

If it was a resolution problem, the following code produces
high-resolution datestamps:

def format_highres_date(t, offset):
    import time
    tt = time.gmtime(t + offset)
    return (time.strftime("%a %Y-%m-%d %H:%M:%S", tt)
            + ('%.9f' % (t - int(t)))[1:]
            + ' %+03d%02d' % (offset / 3600, (offset / 60) % 60))

In my case, doing:
format_highres_date(time.time(), -time.altzone)
'Thu 2005-06-30 13:16:08.646850109 -0500'

Which I think is pretty concise, and more understandable than the
 >>> print 'timestamp="%.9f", timezone="%d"' % (time.time(), -time.altzone)
timestamp="1120155435.368813038", timezone="-18000"

That timestamp is very hard to understand.

I realize that it might be a legacy issue, and that timestamp + timezone
is a little bit easier to parse.
But I'm working on the changeset code, and thus want to change to
displaying high-res datestamps, and was wondering if we could convert
over to using them in the actual revision XML. I have to write the
functions to create them, and then parse them anyway, since I need it
for the changeset code.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050630/cf8caf79/attachment.pgp 

More information about the bazaar mailing list