Backport commit 3abb3681b from Emacs

* lisp/org-macs.el (org-file-newer-than-p):
Don’t assume list-format timestamps, by using
org-time-convert-to-integer instead of doing it by hand.

Use org-time-convert-to-integer instead of by hand
3abb3681b57d7c8ca7fa808addb0a10b6b109cab
Paul Eggert
Wed Apr 27 00:30:25 2022 -0700
This commit is contained in:
Paul Eggert 2022-04-27 00:29:26 -07:00 committed by Kyle Meyer
parent 723af4afae
commit 56ba22b9df
1 changed files with 4 additions and 3 deletions

View File

@ -257,15 +257,16 @@ ignored in this case."
(defun org-file-newer-than-p (file time) (defun org-file-newer-than-p (file time)
"Non-nil if FILE is newer than TIME. "Non-nil if FILE is newer than TIME.
FILE is a filename, as a string, TIME is a list of integers, as FILE is a filename, as a string, TIME is a Lisp time value, as
returned by, e.g., `current-time'." returned by, e.g., `current-time'."
(and (file-exists-p file) (and (file-exists-p file)
;; Only compare times up to whole seconds as some file-systems ;; Only compare times up to whole seconds as some file-systems
;; (e.g. HFS+) do not retain any finer granularity. As ;; (e.g. HFS+) do not retain any finer granularity. As
;; a consequence, make sure we return non-nil when the two ;; a consequence, make sure we return non-nil when the two
;; times are equal. ;; times are equal.
(not (time-less-p (cl-subseq (nth 5 (file-attributes file)) 0 2) (not (time-less-p (org-time-convert-to-integer
(cl-subseq time 0 2))))) (nth 5 (file-attributes file)))
(org-time-convert-to-integer time)))))
(defun org-compile-file (source process ext &optional err-msg log-buf spec) (defun org-compile-file (source process ext &optional err-msg log-buf spec)
"Compile a SOURCE file using PROCESS. "Compile a SOURCE file using PROCESS.