[Buildbot-commits] [Buildbot] #2522: test_changes_mail_CVSMaildirSource fails in some timezones
Buildbot trac
trac at buildbot.net
Sat Sep 7 20:45:07 UTC 2013
#2522: test_changes_mail_CVSMaildirSource fails in some timezones
----------------------+------------------------
Reporter: rutsky | Owner:
Type: undecided | Status: new
Priority: major | Milestone: undecided
Version: master | Resolution:
Keywords: |
----------------------+------------------------
Comment (by dustin):
marchael is seeing the same error (also in Europe/Moscow). Here's the
date handling I see:
Parse the Date header using `email.Utils.parsedate_tz`, returning a
10-tuple, the last element of which is the timezone offset from UTC. This
should be a tz-invariant transformation, and the timezone offset in the
input string is 0.
{{{
>>> parsedate_tz(m["date"])
(2010, 8, 7, 11, 11, 49, 0, 1, -1, 0)
}}}
This value is then immediately converted into an epoch timestamp (which is
always implicitly UTC-oriented). This, too, is a tz-invariant
transformation.
{{{
>>> mktime_tz(dateTuple)
1281179509
}}}
This is then converted into a UTC datetime object, again without reference
to the tz:
{{{
>>> datetime.datetime.utcfromtimestamp(float(when))
datetime.datetime(2010, 8, 7, 11, 11, 49)
}}}
Finally, this is converted to a string using stftime, which again is tz-
independent:
{{{
>>> theTime.strftime('%Y-%m-%d %H:%M:%S')
'2010-08-07 11:11:49'
}}}
Indeed, I get the same time here in US/Eastern and on a host in
Europe/Berlin.
Can one of you folks let me know how the following script behaves?
{{{
#!/usr/bin/env python
import datetime
import email.utils
dateTuple = email.utils.parsedate_tz('Sat, 07 Aug 2010 11:11:49 +0000')
print dateTuple
when = email.utils.mktime_tz(dateTuple)
print when
theTime = datetime.datetime.utcfromtimestamp(float(when))
print theTime
rev = theTime.strftime('%Y-%m-%d %H:%M:%S')
print rev
}}}
--
Ticket URL: <http://trac.buildbot.net/ticket/2522#comment:3>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation
More information about the Commits
mailing list