diff --git a/lisp/org-compat.el b/lisp/org-compat.el index cae8a05f0..2fb623da3 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -90,12 +90,16 @@ is nil)." ;; The misspelled variant was made obsolete in Emacs 27.1 (defalias 'pcomplete-uniquify-list 'pcomplete-uniqify-list)) -(defun org-current-time-as-list () - "Compatibility wrapper for `current-time'. -As of Emacs 27.1, `current-time' callers should not assume a list -return value." - (or (ignore-errors (encode-time nil 'list)) - (current-time))) +(if (fboundp 'time-convert) + (progn + (defsubst org-time-convert-to-integer (time) + (time-convert time 'integer)) + (defsubst org-time-convert-to-list (time) + (time-convert time 'list))) + (defun org-time-convert-to-integer (time) + (floor (float-time time))) + (defun org-time-convert-to-list (time) + (seconds-to-time (float-time time)))) ;;; Emacs < 26.1 compatibility diff --git a/lisp/org-id.el b/lisp/org-id.el index c8de8dd41..52fce5468 100644 --- a/lisp/org-id.el +++ b/lisp/org-id.el @@ -357,7 +357,7 @@ So a typical ID could look like \"Org:4nd91V40HI\"." "Return string with random (version 4) UUID." (let ((rnd (md5 (format "%s%s%s%s%s%s%s" (random) - (org-current-time-as-list) + (org-time-convert-to-list nil) (user-uid) (emacs-pid) (user-full-name) @@ -419,7 +419,7 @@ using `org-id-decode'." ;; FIXME: If TIME represents N seconds after the epoch, then ;; this encoding assumes 0 <= N < 110075314176 = (* (expt 36 4) 65536), ;; i.e., that TIME is from 1970-01-01 00:00:00 to 5458-02-23 20:09:36 UTC. - (setq time (or time (org-current-time-as-list))) + (setq time (org-time-convert-to-list nil)) (concat (org-id-int-to-b36 (nth 0 time) 4) (org-id-int-to-b36 (nth 1 time) 4) (org-id-int-to-b36 (nth 2 time) 4)))