patchbomb does not handle email time stamp plattform independent
authorVolker Kleinfeld <Volker.Kleinfeld@gmx.de>
Fri, 16 Jun 2006 07:07:11 -0700
changeset 2443 bd9c39e8f38b
parent 2442 c660691fb45d
child 2445 e58889a9d378
patchbomb does not handle email time stamp plattform independent
hgext/patchbomb.py
--- a/hgext/patchbomb.py	Thu Jun 15 17:07:30 2006 -0700
+++ b/hgext/patchbomb.py	Fri Jun 16 07:07:11 2006 -0700
@@ -217,7 +217,14 @@
     if not opts['test'] and not opts['mbox']:
         mail = ui.sendmail()
     parent = None
-    tz = time.strftime('%z')
+
+    # Calculate UTC offset
+    if time.daylight: offset = time.altzone
+    else: offset = time.timezone
+    if offset <= 0: sign, offset = '+', -offset
+    else: sign = '-'
+    offset = '%s%02d%02d' % (sign, offset / 3600, (offset % 3600) / 60)
+
     sender_addr = email.Utils.parseaddr(sender)[1]
     for m in msgs:
         try:
@@ -228,7 +235,8 @@
             m['In-Reply-To'] = parent
         else:
             parent = m['Message-Id']
-        m['Date'] = time.strftime('%a, %e %b %Y %T ', time.localtime(start_time)) + tz
+        m['Date'] = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime(start_time)) + ' ' + offset
+
         start_time += 1
         m['From'] = sender
         m['To'] = ', '.join(to)