Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cd45a36

Browse files
committed
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.
1 parent fba64e1 commit cd45a36

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/email/Utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ def formatdate(timeval=None, localtime=0):
130130
offset = time.altzone
131131
else:
132132
offset = time.timezone
133-
zone = '%+03d%02d' % (offset / -3600, offset % 60)
133+
hours, minutes = divmod(offset, -3600)
134+
zone = '%+03d%02d' % (hours, minutes / -60)
134135
else:
135136
now = time.gmtime(timeval)
136137
# Timezone offset is always -0000

0 commit comments

Comments
 (0)