time.timezone returns incorrect value when DST rules change

Sjujskij Nikolaj sterkrig at myopera.com
Fri Nov 11 15:51:04 CST 2011


  I can confirm this issue, and here's relevant IRC discussion:

<krigstask> Could anyone describe this timezone issue?  
http://pastie.org/2792160
<ThomasAH> krigstask: maybe your python-tz package is outdated?
<ThomasAH> (or is +0300 your current UTC offset?)
<krigstask> Hm... dev-python/pytz-2011k
<ThomasAH> krigstask: is +3 or +4 correct for you?
<krigstask> And it should be +0400
<ThomasAH> ah, ok
<ThomasAH> krigstask: what's your timezone?
<krigstask> MSK - Moscow Standard Time
<krigstask> Moscow Time has been UTC+4 year-round since 27 March 2011.
<krigstask> ThomasAH: Prior to 27 March 2011, Moscow Time was UTC+3.  
Daylight saving
<krigstask> ( http://en.wikipedia.org/wiki/Moscow_Time )
<ThomasAH> krigstask: How is it called exactly? (e.g. Europe/Berlin)
<krigstask> Europe/Moscow
*krigstask tries to fiddle with timezone info within bpython interpreter
<krigstask> But Mercurial doesn't seem to use pytz
<ThomasAH> krigstask: please try:  python -c "from datetime import  
datetime; from pyt
<ThomasAH> krigstask: for me it returns +0400
<ThomasAH> krigstask: Oh, but I get +0300 in the Mercurial commit, too,  
when setting
<ThomasAH> krigstask: mercurial.util.makedate() is the culprit: it uses  
time.timezone
<ThomasAH> tm_isdst=0, but time.daylight=1? strange ...
<ThomasAH> krigstask: please file a bug report for this

I wanted to patch it myself, but lacked enough time.

> Russia abandoned winter time this year and time.timezone is returning an
> incorrect value in this case (see http://bugs.python.org/issue1647654).
>
> The impact on mercurial is that the timezone offset is incorrect in both
> outgoing emails and changelogs. Since the underlying problem is quite
> tricky to fix, I suggest the attached patch (applies to the current
> tip). Please consider applying. Apologies if it's been already
> discussed, I'm not following the mailing list.
  Patches should *not* be attached, see  
http://mercurial.selenic.com/wiki/ContributingChanges
(That's why nobody has answered, I daressay)


More information about the Mercurial-devel mailing list