Package: python
Version: 2.7.9-1

When I use time or datetime library to get time, timezone returns the OS timezone. On the other hand when I use email.Utils.formatdate(localtime=1) to get time, timezone reported as +02 which differs from OS timezone. Mailman, uses email.Utils.formatdate(localtime=1) in different files when building e-mail headers for reporting purposes, fails to report correct timezone.

# pwd
/usr/lib/mailman/Mailman

# grep -irl "email.Utils.formatdate(localtime=1)" *
ListAdmin.py
Message.py
MTA/Manual.py



Here is a transcript:


# date
Tue Nov 29 16:31:42 +03 2016

# python
Python 2.7.9 (default, Jun 29 2016, 13:08:31)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> import time
>>> print (time.localtime())
time.struct_time(tm_year=2016, tm_mon=11, tm_mday=29, tm_hour=16, tm_min=33, tm_sec=16, tm_wday=1, tm_yday=334, tm_isdst=0)
>>> print (time.daylight)
1
>>>time.strftime('%X %x %Z')
'16:36:49 11/29/16 +03'

>>> import datetime
>>> datetime.datetime.now().time()
datetime.time(16, 37, 34, 810249)
>>> datetime.datetime.utcnow().time()
datetime.time(13, 39, 12, 200488)

>>> import email.utils
>>> print (email.Utils.formatdate())
Tue, 29 Nov 2016 13:35:34 -0000
>>> print (email.Utils.formatdate(localtime=1))
Tue, 29 Nov 2016 16:35:49 +0200

>>> quit()

# uname -a
Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux


I suggest that the timezone error in python email.utils be corrected.

Reply via email to