1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-03 22:20:52 -08:00

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.
This commit is contained in:
Paul Eggert 2018-09-13 17:31:58 -07:00
parent c44bc4d370
commit da4e5f6685
2 changed files with 4 additions and 8 deletions

View file

@ -1016,9 +1016,7 @@ current iCalendar object, as a string. Increase
(setq icalendar--uid-count (1+ icalendar--uid-count))
(setq uid (replace-regexp-in-string
"%t"
(format "%d%d%d" (car (current-time))
(cadr (current-time))
(car (cddr (current-time))))
(format-time-string "%s%N")
uid t t))
(setq uid (replace-regexp-in-string
"%h"

View file

@ -764,7 +764,7 @@ This variable is set by `nnmaildir-request-article'.")
(defun nnmaildir--scan (gname scan-msgs groups _method srv-dir srv-ls)
(catch 'return
(let ((36h-ago (- (car (current-time)) 2))
(let ((36h-ago (- (float-time) 129600))
absdir nndir tdir ndir cdir nattr cattr isnew pgname read-only ls
files num dir flist group x)
(setq absdir (nnmaildir--srvgrp-dir srv-dir gname)
@ -801,7 +801,7 @@ This variable is set by `nnmaildir-request-article'.")
(throw 'return nil))
(dolist (file (funcall ls tdir 'full "\\`[^.]" 'nosort))
(setq x (file-attributes file))
(if (or (> (cadr x) 1) (< (car (nth 4 x)) 36h-ago))
(if (or (> (cadr x) 1) (time-less-p (nth 4 x) 36h-ago))
(delete-file file))))
(or scan-msgs
isnew
@ -1463,9 +1463,7 @@ This variable is set by `nnmaildir-request-article'.")
(unless (string-equal nnmaildir--delivery-time file)
(setq nnmaildir--delivery-time file
nnmaildir--delivery-count 0))
(when (and (consp (cdr time))
(consp (cddr time)))
(setq file (concat file "M" (number-to-string (caddr time)))))
(setq file (concat file (format-time-string "M%6N" time)))
(setq file (concat file nnmaildir--delivery-pid)
file (concat file "Q" (number-to-string nnmaildir--delivery-count))
file (concat file "." (nnmaildir--system-name))