]> git.ozlabs.org Git - patchwork/blobdiff - apps/patchwork/models.py
models: Fix invalid dates in patch mbox
[patchwork] / apps / patchwork / models.py
index a9e70ced4c141cdc5b3dfc97115d665707ef4617..250ad018bb87806e674c4ba63ddcea109627587e 100644 (file)
@@ -279,10 +279,12 @@ class Patch(models.Model):
         if self.content:
             body += '\n' + self.content
 
+        utc_timestamp = (self.date -
+                datetime.datetime.utcfromtimestamp(0)).total_seconds()
+
         mail = PatchMbox(body)
         mail['Subject'] = self.name
-        mail['Date'] = email.utils.formatdate(
-                        time.mktime(self.date.utctimetuple()))
+        mail['Date'] = email.utils.formatdate(utc_timestamp)
         mail['From'] = email.utils.formataddr((
                         str(Header(self.submitter.name, mail.patch_charset)),
                         self.submitter.email))