--- a/Lib/email/utils.py +++ b/Lib/email/utils.py @@ -159,17 +159,14 @@ now = time.localtime(timeval) # Calculate timezone offset, based on whether the local zone has # daylight savings time, and whether DST is in effect. - if time.daylight and now[-1]: - offset = time.altzone - else: - offset = time.timezone + offset = now.tm_gmtoff hours, minutes = divmod(abs(offset), 3600) # Remember offset is in seconds west of UTC, but the timezone is in # minutes east of UTC, so the signs differ. if offset > 0: - sign = '-' - else: sign = '+' + else: + sign = '-' zone = '%s%02d%02d' % (sign, hours, minutes // 60) else: now = time.gmtime(timeval)