Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 097D6431FAE for ; Thu, 14 Jun 2012 11:16:08 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W8YKo5oemgCU for ; Thu, 14 Jun 2012 11:16:07 -0700 (PDT) X-Greylist: delayed 3603 seconds by postgrey-1.32 at olra; Thu, 14 Jun 2012 11:16:07 PDT Received: from smtpauth.johnshopkins.edu (smtpauth.johnshopkins.edu [128.220.160.201]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 73578431FB6 for ; Thu, 14 Jun 2012 11:16:07 -0700 (PDT) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkwJAIwb2k8KoSES/2dsb2JhbABFtA0DgjOCGQEFeRAYFAwZDwEsGxm5EIkEjCmBcwyDGwObFwOMfw X-IronPort-AV: E=Sophos;i="4.75,770,1330923600"; d="scan'208";a="173409136" Received: from unknown (HELO watt) ([10.161.33.18]) by ipex4.johnshopkins.edu with ESMTP/TLS/AES256-SHA; 14 Jun 2012 13:16:01 -0400 Received: from jkr by watt with local (Exim 4.76) (envelope-from ) id 1SfDeN-000304-QQ; Thu, 14 Jun 2012 13:16:03 -0400 From: Jesse Rosenthal To: notmuch@notmuchmail.org Subject: [PATCHv2] emacs: derive correct timestamp in FCC unique name In-Reply-To: <87d353ezyw.fsf@jhu.edu> References: <87d353ezyw.fsf@jhu.edu> User-Agent: Notmuch/0.12~rc1 (http://notmuchmail.org) Emacs/24.1.50.1 (i686-pc-linux-gnu) Date: Thu, 14 Jun 2012 13:16:03 -0400 Message-ID: <87y5npg6gc.fsf@jhu.edu> MIME-Version: 1.0 Content-Type: text/plain Cc: Tomi Ollila X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 18:16:08 -0000 Previously, the timestamp at the beginning of the FCC unique maildir name was derived incorrectly, thanks to an integer overflow. This changes the derivation of timestamp to use a float, and so will get the number correct at least until 2038. (It is still formatted with "%d" so it will show up as an integer.) Should we need to change it in the next 26 years to take the unix millenium into account, it will be invisible to users. This change is mostly a question of consistency, since the unique name is arbitrary anyway. But since most people use timestamps, and that was the original intention here as well, we might as well. Signed-off-by: Jesse Rosenthal --- emacs/notmuch-maildir-fcc.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el index dcfbc4b..07eedba 100644 --- a/emacs/notmuch-maildir-fcc.el +++ b/emacs/notmuch-maildir-fcc.el @@ -140,13 +140,12 @@ will NOT be removed or replaced." t)) (defun notmuch-maildir-fcc-make-uniq-maildir-id () - (let* ((ct (current-time)) - (timeid (+ (* (car ct) 65536) (cadr ct))) - (microseconds (car (cdr (cdr ct)))) + (let* ((ftime (float-time)) + (microseconds (mod (* 1000000 ftime) 1000000)) (hostname (notmuch-maildir-fcc-host-fixer system-name))) (setq notmuch-maildir-fcc-count (+ notmuch-maildir-fcc-count 1)) (format "%d.%d_%d_%d.%s" - timeid + ftime (emacs-pid) microseconds notmuch-maildir-fcc-count -- 1.7.9.5