aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2018-09-13 17:31:58 -0700
committerPaul Eggert2018-09-13 17:32:33 -0700
commitda4e5f668582e1f047b6bd5259a1a4f92b5461b6 (patch)
tree7667273c2d62df723916ec00f02c73613ff290df
parentc44bc4d370b38ac3e9da15579fd372d1410d4b4c (diff)
downloademacs-da4e5f668582e1f047b6bd5259a1a4f92b5461b6.tar.gz
emacs-da4e5f668582e1f047b6bd5259a1a4f92b5461b6.zip
Simplify use of timestamps
* lisp/calendar/icalendar.el (icalendar--create-uid): * lisp/gnus/nnmaildir.el (nnmaildir-request-accept-article): Simplify by using format-time-string. * lisp/gnus/nnmaildir.el (nnmaildir--scan): Simplify by using float-time and time-less-p.
-rw-r--r--lisp/calendar/icalendar.el4
-rw-r--r--lisp/gnus/nnmaildir.el8
2 files changed, 4 insertions, 8 deletions
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index c1a3e0a4213..e3e458a4dd7 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -1016,9 +1016,7 @@ current iCalendar object, as a string. Increase
1016 (setq icalendar--uid-count (1+ icalendar--uid-count)) 1016 (setq icalendar--uid-count (1+ icalendar--uid-count))
1017 (setq uid (replace-regexp-in-string 1017 (setq uid (replace-regexp-in-string
1018 "%t" 1018 "%t"
1019 (format "%d%d%d" (car (current-time)) 1019 (format-time-string "%s%N")
1020 (cadr (current-time))
1021 (car (cddr (current-time))))
1022 uid t t)) 1020 uid t t))
1023 (setq uid (replace-regexp-in-string 1021 (setq uid (replace-regexp-in-string
1024 "%h" 1022 "%h"
diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el
index c8480ddda4c..48a470c7462 100644
--- a/lisp/gnus/nnmaildir.el
+++ b/lisp/gnus/nnmaildir.el
@@ -764,7 +764,7 @@ This variable is set by `nnmaildir-request-article'.")
764 764
765(defun nnmaildir--scan (gname scan-msgs groups _method srv-dir srv-ls) 765(defun nnmaildir--scan (gname scan-msgs groups _method srv-dir srv-ls)
766 (catch 'return 766 (catch 'return
767 (let ((36h-ago (- (car (current-time)) 2)) 767 (let ((36h-ago (- (float-time) 129600))
768 absdir nndir tdir ndir cdir nattr cattr isnew pgname read-only ls 768 absdir nndir tdir ndir cdir nattr cattr isnew pgname read-only ls
769 files num dir flist group x) 769 files num dir flist group x)
770 (setq absdir (nnmaildir--srvgrp-dir srv-dir gname) 770 (setq absdir (nnmaildir--srvgrp-dir srv-dir gname)
@@ -801,7 +801,7 @@ This variable is set by `nnmaildir-request-article'.")
801 (throw 'return nil)) 801 (throw 'return nil))
802 (dolist (file (funcall ls tdir 'full "\\`[^.]" 'nosort)) 802 (dolist (file (funcall ls tdir 'full "\\`[^.]" 'nosort))
803 (setq x (file-attributes file)) 803 (setq x (file-attributes file))
804 (if (or (> (cadr x) 1) (< (car (nth 4 x)) 36h-ago)) 804 (if (or (> (cadr x) 1) (time-less-p (nth 4 x) 36h-ago))
805 (delete-file file)))) 805 (delete-file file))))
806 (or scan-msgs 806 (or scan-msgs
807 isnew 807 isnew
@@ -1463,9 +1463,7 @@ This variable is set by `nnmaildir-request-article'.")
1463 (unless (string-equal nnmaildir--delivery-time file) 1463 (unless (string-equal nnmaildir--delivery-time file)
1464 (setq nnmaildir--delivery-time file 1464 (setq nnmaildir--delivery-time file
1465 nnmaildir--delivery-count 0)) 1465 nnmaildir--delivery-count 0))
1466 (when (and (consp (cdr time)) 1466 (setq file (concat file (format-time-string "M%6N" time)))
1467 (consp (cddr time)))
1468 (setq file (concat file "M" (number-to-string (caddr time)))))
1469 (setq file (concat file nnmaildir--delivery-pid) 1467 (setq file (concat file nnmaildir--delivery-pid)
1470 file (concat file "Q" (number-to-string nnmaildir--delivery-count)) 1468 file (concat file "Q" (number-to-string nnmaildir--delivery-count))
1471 file (concat file "." (nnmaildir--system-name)) 1469 file (concat file "." (nnmaildir--system-name))