diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2019-02-22 13:24:16 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2019-02-22 13:31:01 -0800 |
commit | eba66c1eafeef6512259c9b46face2b03c7433b8 (patch) | |
tree | 0945a1e684448ba37146dbd36cd71dc91d70dad2 /lisp/net/pop3.el | |
parent | 0613e7a38efc3b0534e0ca5c5fa401e2a3bda906 (diff) | |
download | emacs-eba66c1eafeef6512259c9b46face2b03c7433b8.tar.gz |
Remove some timestamp format assumptions
Don’t assume that current-time and plain encode-time return
timestamps in (HI LO US PS) format.
* lisp/gnus/gnus-art.el (article-make-date-line)
(article-lapsed-string):
* lisp/gnus/gnus-demon.el (gnus-demon-time-to-step):
* lisp/gnus/gnus-diary.el (gnus-user-format-function-d):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/net/pop3.el (pop3-uidl-dele):
* lisp/org/ox-publish.el (org-publish-sitemap):
* lisp/vc/vc-hg.el (vc-hg-state-fast):
Simplify and remove assumptions about timestamp format.
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-diary.el (gnus-user-format-function-d):
Do not worry about time-subtract returning nil; that's not possible.
* lisp/gnus/gnus-diary.el (gnus-user-format-function-d):
Avoid race due to duplicate current-time calls.
* lisp/vc/vc-hg.el (vc-hg--time-to-integer): Remove; no longer used.
Diffstat (limited to 'lisp/net/pop3.el')
-rw-r--r-- | lisp/net/pop3.el | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lisp/net/pop3.el b/lisp/net/pop3.el index 3aac5b5c45c..cd6a113bffe 100644 --- a/lisp/net/pop3.el +++ b/lisp/net/pop3.el @@ -180,8 +180,8 @@ Shorter values mean quicker response, but are more CPU intensive.") ;; ("SERVER_B" ("USER_B1" "UIDL1" TIMESTAMP1 "UIDL2" TIMESTAMP2...) ;; ("USER_B2" "UIDL1" TIMESTAMP1 "UIDL2" TIMESTAMP2...) ;; ...)) -;; Where TIMESTAMP is the most significant two digits of an Emacs time, -;; i.e. the return value of `current-time'. +;; Where TIMESTAMP is an Emacs time value (HI LO) representing the +;; number of seconds (+ (ash HI 16) LO). ;;;###autoload (defun pop3-movemail (file) @@ -380,7 +380,9 @@ Use streaming commands." (defun pop3-uidl-dele (process) "Delete messages according to `pop3-leave-mail-on-server'. Return non-nil if it is necessary to update the local UIDL file." - (let* ((ctime (current-time)) + (let* ((ctime (encode-time nil 'list)) + (age-limit (and (numberp pop3-leave-mail-on-server) + (* 86400 pop3-leave-mail-on-server))) (srvr (assoc pop3-mailhost pop3-uidl-saved)) (saved (assoc pop3-maildrop (cdr srvr))) i uidl mod new tstamp dele) @@ -397,17 +399,13 @@ Return non-nil if it is necessary to update the local UIDL file." (setq new (mapcan (lambda (elt) (list elt ctime)) pop3-uidl)))) (when new (setq mod t)) ;; List expirable messages and delete them from the data to be saved. - (setq ctime (when (numberp pop3-leave-mail-on-server) - (/ (+ (* (car ctime) 65536.0) (cadr ctime)) 86400)) - i (1- (length saved))) + (setq i (1- (length saved))) (while (> i 0) (if (member (setq uidl (nth (1- i) saved)) pop3-uidl) (progn (setq tstamp (nth i saved)) - (if (and ctime - (> (- ctime (/ (+ (* (car tstamp) 65536.0) (cadr tstamp)) - 86400)) - pop3-leave-mail-on-server)) + (if (and age-limit + (time-less-p age-limit (time-subtract ctime tstamp))) ;; Mails to delete. (progn (setq mod t) |