You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2018/02/23 11:24:40 UTC

[incubator-ponymail] branch master updated: Only calculate the epoch once

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail.git


The following commit(s) were added to refs/heads/master by this push:
     new bc6ae7e  Only calculate the epoch once
bc6ae7e is described below

commit bc6ae7e0358883b536e53157b0ee783502f69ab3
Author: Sebb <se...@apache.org>
AuthorDate: Fri Feb 23 11:24:38 2018 +0000

    Only calculate the epoch once
---
 tools/archiver.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/archiver.py b/tools/archiver.py
index 57d7a6c..3163a4a 100755
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -312,7 +312,10 @@ class Archiver(object): # N.B. Also used by import-mbox.py
             print("Date (%s) seems totally wrong, setting to _now_ instead." % mdate)
             mdate = time.gmtime() # Get a standard 9-tuple
             mdate = mdate + (0, ) # Fake a TZ (10th element)
-        mdatestring = time.strftime("%Y/%m/%d %H:%M:%S", time.gmtime(email.utils.mktime_tz(mdate)))
+
+        # mdate calculations are all done, prepare the index entry
+        epoch = email.utils.mktime_tz(mdate))
+        mdatestring = time.strftime("%Y/%m/%d %H:%M:%S", time.gmtime(epoch)
         body = self.msgbody(msg)
         try:
             if 'content-type' in msg_metadata and msg_metadata['content-type'].find("flowed") != -1:
@@ -365,7 +368,7 @@ class Archiver(object): # N.B. Also used by import-mbox.py
                 'message-id': msg_metadata['message-id'],
                 'mid': mid,
                 'cc': msg_metadata.get('cc'),
-                'epoch': email.utils.mktime_tz(mdate),
+                'epoch': epoch,
                 'list': lid,
                 'list_raw': lid,
                 'date': mdatestring,

-- 
To stop receiving notification emails like this one, please contact
sebb@apache.org.