[Buildbot-commits] [Buildbot] #2522: test_changes_mail_CVSMaildirSource fails in some timezones

Buildbot trac trac at buildbot.net
Wed Oct 9 22:09:59 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 rutsky):

 Replying to [comment:7 dustin]:
 > rutsky, any update?

 Sorry for the late response, Dustin, I was on vacation.

 I agree with code flow described in comment:3.  On my system
 `email.utils.parsedate_tz` returns correct tuple as on your's; problem
 observed in result of `email.utils.mktime_tz`, as you noticed.

 Source of the problem in `email.utils.mktime_tz` implementation.  In this
 code

 {{{
 #!python
         t = time.mktime(data[:8] + (0,))
         return t - data[9] - time.timezone
 }}}

 `data` tuple interpreted as local time in current time zone without DST
 correction (isdst=0) and converted to POSIX time. Then from POSIX time
 subtracted local time zone offset (lets assume that `data[9] == 0`).

 This code would work correctly if offset from UTC to standard local time
 (without DST correction) would be constant, but this isn't true.  E.g.
 standard local time of Europe/Moscow was GMT+3 in 1996--2010, but since
 2011 it's GMT+4 --- this gives that 1 hour of difference, because current
 `time.timezone` of my system corresponds to GMT+4, but `time.mktime`
 returns POSIX time on the assumption of GMT+3 standard local time.

 I believe that this behaviour of `email.utils.mktime_tz` was meant by
 "Minor deficiency" comment in documentation.  Fortunately this strange and
 unexpected behavior was reported to Python and already fixed in Python
 2.7.4: http://bugs.python.org/issue14653 (but I didn't tested it on 2.7.4
 actually).

 Other case when this bug can not be reproduced is if you have old version
 of tzdata package that doesn't include such timezone changes for year
 2010.

-- 
Ticket URL: <http://trac.buildbot.net/ticket/2522#comment:8>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the Commits mailing list