summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-11-19 16:28:07 (GMT)
committerBarry Warsaw <barry@python.org>2001-11-19 16:28:07 (GMT)
commitcd45a36959f3a8a74731c7dc25fee95108198e7d (patch)
treeb5fdaa06587299560d4b498d021b3f7a4eee1c41 /Lib
parentfba64e1ecaa62799ee62e5c9988d2496ed6125d0 (diff)
downloadcpython-cd45a36959f3a8a74731c7dc25fee95108198e7d.zip
cpython-cd45a36959f3a8a74731c7dc25fee95108198e7d.tar.gz
cpython-cd45a36959f3a8a74731c7dc25fee95108198e7d.tar.bz2
formatdate(): The calculation of the minutes part of the zone was
incorrect for "uneven" timezones. This algorithm should work for even timezones (e.g. America/New_York) and uneven timezones (e.g. Australia/Adelaide and America/St_Johns). Closes SF bug #483231.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/email/Utils.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/email/Utils.py b/Lib/email/Utils.py
index 58fd8da..8d46096 100644
--- a/Lib/email/Utils.py
+++ b/Lib/email/Utils.py
@@ -130,7 +130,8 @@ def formatdate(timeval=None, localtime=0):
offset = time.altzone
else:
offset = time.timezone
- zone = '%+03d%02d' % (offset / -3600, offset % 60)
+ hours, minutes = divmod(offset, -3600)
+ zone = '%+03d%02d' % (hours, minutes / -60)
else:
now = time.gmtime(timeval)
# Timezone offset is always -0000