[Python-bugs-list] [ python-Bugs-483231 ] email.Utils.formatdate(): localtime bug

noreply@sourceforge.net noreply@sourceforge.net
Mon, 19 Nov 2001 08:31:37 -0800


Bugs item #483231, was opened at 2001-11-18 18:33
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=483231&group_id=5470

Category: Python Library
Group: Python 2.2
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Jason R. Mastaler (jasonrm)
Assigned to: Barry Warsaw (bwarsaw)
Summary: email.Utils.formatdate(): localtime bug

Initial Comment:
email.Utils.formatdate(localtime=1) does 
not produce a correct UTC offset for 
"uneven" timezones (e.g, "+1030", "+0530")
In those cases, it rounds the offset down
to "+1000", and "+0500".

In the example below, you can see that
python produces the wrong UTC offset
once I set my TZ to "Australia/Adelaide",
a timezone whose offset should be "+1030".

$ date
Sun Nov 18 19:29:22 MST 2001
$ python2.2 -c 'import email;print 
email.Utils.formatdate(localtime=1)'
Sun, 18 Nov 2001 19:29:22 -0700

$ export TZ="Australia/Adelaide"
$ date
Mon Nov 19 12:59:35 CST 2001
$ python2.2 -c 'import email;print 
email.Utils.formatdate(localtime=1)'
Mon, 19 Nov 2001 12:59:35 +1000




----------------------------------------------------------------------

>Comment By: Barry Warsaw (bwarsaw)
Date: 2001-11-19 08:31

Message:
Logged In: YES 
user_id=12800

Fixed in Lib/email/Utils.py 1.7

----------------------------------------------------------------------

Comment By: Jason R. Mastaler (jasonrm)
Date: 2001-11-18 18:54

Message:
Logged In: YES 
user_id=85984

Just to followup with some more info:

I forgot to mention I'm running Python 2.2b2
on FreeBSD 4.4-RELEASE.

Also, when investigating this problem, don't
forget timezones with negative fractional 
UTC offsets (e.g, -0330) in addition to positive.

Such is the case when TZ is "Canada/Newfoundland"
or "America/St_Johns" for example.




----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=483231&group_id=5470