Re: [PATCHv2] emacs: derive correct timestamp in FCC unique name

2012-06-22 Thread David Bremner
Jesse Rosenthal jrosent...@jhu.edu writes:


 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.

pushed.

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCHv2] emacs: derive correct timestamp in FCC unique name

2012-06-14 Thread Tomi Ollila
On Thu, Jun 14 2012, Jesse Rosenthal  wrote:

> 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 
> ---


+1


Tomi

>  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 (* 100 ftime) 100))
> (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
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCHv2] emacs: derive correct timestamp in FCC unique name

2012-06-14 Thread Jesse Rosenthal

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 (* 100 ftime) 100))
  (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