Notification mail has wrong timezone info.
sample:
From: "QOS" <qos@XXX.com>
Subject: *Good-qos_WebProxy_qa-webproxy is OK
2001/10/22 11:25
Date: Mon, 22 Oct 2001 11:25:53 -0800 (PDT)
PDT should have an offset of -0700, not -0800
Here's a patch:
diff -u sendmail.py.orig sendmail.py
--- sendmail.py.orig Tue Oct 23 15:41:36 2001
+++ sendmail.py Tue Oct 23 16:07:45 2001
@@ -54,9 +54,15 @@
datestr = time.strftime ('%a, %d %b %Y
%H:%M:%S', t)
if sec_offset >= 0:
sign = '-'
+ daylight_offset = -3600
else:
sign = '+'
- emailDate = "%s %s%02d00 (%s)" % (datestr,
sign, abs(sec_offset / 3600),
time.tzname[time.daylight])
+ daylight_offset = 3600
+ if time.daylight == 1:
+ real_offset = abs((sec_offset +
daylight_offset) / 3600)
+ else:
+ real_offset = abs(sec_offset / 3600)
+ emailDate = "%s %s%02d00 (%s)" % (datestr,
sign, real_offset, time.tzname[time.daylight])
fp.write("Date: %s\n" % emailDate)
Logged In: YES
user_id=354757
Here's a better patch:
> diff -u sendmail.py.orig sendmail.py
--- sendmail.py.orig Tue Oct 23 15:41:36 2001
+++ sendmail.py Sun Oct 28 17:53:21 2001
@@ -54,9 +54,17 @@
datestr = time.strftime ('%a, %d %b %Y %H:%M:%S',
t)
if sec_offset >= 0:
sign = '-'
+ daylight_offset = -3600
else:
sign = '+'
- emailDate = "%s %s%02d00 (%s)" % (datestr, sign,
abs(sec_offset / 3600), time.tzname[time.daylight])
+ daylight_offset = 3600
+ tzstr = time.strftime ('%Z', t)
+ # are we in DST?
+ if time.daylight == 1 and tzstr == time.tzname[1]:
+ real_offset = abs((sec_offset + daylight_offset)
/ 3600)
+ else:
+ real_offset = abs(sec_offset / 3600)
+ emailDate = "%s %s%02d00 (%s)" % (datestr, sign,
real_offset, tzstr)
fp.write("Date: %s\n" % emailDate)