summaryrefslogtreecommitdiff
path: root/lisp/find-lisp.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-02-10 23:46:24 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2019-02-10 23:54:35 -0800
commit93241242537ad18b08486d4abd00e16c225a6a30 (patch)
tree762c5c8c203c4b1f93a5b9f2fafbf86fbd894ce7 /lisp/find-lisp.el
parent988e37fa0f922b852715671d59a0e3f682373411 (diff)
downloademacs-93241242537ad18b08486d4abd00e16c225a6a30.tar.gz
Don’t assume CURRENT_TIME_LIST
Use timestamp accessors instead of delving into a timestamp format that is planned to change in a future version. * lisp/find-lisp.el (find-lisp-format-time): * lisp/gnus/gnus-group.el (gnus-group-set-timestamp): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-show-org-agenda): Use encode-time instead of delving into timestamp format. * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): Use float-time instead of delving into timestamp format. * lisp/gnus/nnmaildir.el (nnmaildir-request-accept-article): Use format-time-string instead of delving into timestamp format. * lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles): Use time-less-p instead of delving into timestamp format. * lisp/ido.el (ido-wash-history, ido-file-name-all-completions): Use time-equal-p instead of delving into timestamp format. * lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times): Use format-time-string to generate POSIX ‘test -t’ format instead of timestamp-format-dependent code along with shell arithmetic that can’t possibly do the right thing on a POSIX platform.
Diffstat (limited to 'lisp/find-lisp.el')
-rw-r--r--lisp/find-lisp.el11
1 files changed, 3 insertions, 8 deletions
diff --git a/lisp/find-lisp.el b/lisp/find-lisp.el
index c5febee6f5c..073e2bc573f 100644
--- a/lisp/find-lisp.el
+++ b/lisp/find-lisp.el
@@ -342,16 +342,11 @@ list of ls option letters of which c and u are recognized). Use
the same method as \"ls\" to decide whether to show time-of-day or
year, depending on distance between file date and NOW."
(let* ((time (nth (find-lisp-time-index switches) file-attr))
- (diff16 (- (car time) (car now)))
- (diff (+ (ash diff16 16) (- (car (cdr time)) (car (cdr now)))))
- (past-cutoff (- (* 6 30 24 60 60))) ; 6 30-day months
+ (diff (encode-time (time-subtract time now) 'integer))
+ (past-cutoff -15778476) ; 1/2 of a Gregorian year
(future-cutoff (* 60 60))) ; 1 hour
(format-time-string
- (if (and
- (<= past-cutoff diff) (<= diff future-cutoff)
- ;; Sanity check in case `diff' computation overflowed.
- (<= (1- (ash past-cutoff -16)) diff16)
- (<= diff16 (1+ (ash future-cutoff -16))))
+ (if (<= past-cutoff diff future-cutoff)
"%b %e %H:%M"
"%b %e %Y")
time)))