Backport commit 5f3f3884a from Emacs

Improve time function doc
5f3f3884a0d2a88101d330b82ef5b584cfc02aa6
Paul Eggert
Sun Aug 4 10:09:25 2019 -0700
This commit is contained in:
Paul Eggert 2019-08-04 09:57:27 -07:00 committed by Kyle Meyer
parent 765577d9b3
commit 71ce18920a
1 changed files with 5 additions and 2 deletions

View File

@ -413,9 +413,12 @@ The input I may be a character, or a single-letter string."
r))
(defun org-id-time-to-b36 (&optional time)
"Encode TIME as a 10-digit string.
"Encode TIME as a 12-digit string.
This string holds the time to micro-second accuracy, and can be decoded
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)))
(concat (org-id-int-to-b36 (nth 0 time) 4)
(org-id-int-to-b36 (nth 1 time) 4)
@ -424,7 +427,7 @@ using `org-id-decode'."
(defun org-id-decode (id)
"Split ID into the prefix and the time value that was used to create it.
The return value is (prefix . time) where PREFIX is nil or a string,
and time is the usual three-integer representation of time."
and TIME is a Lisp time value (HI LO USEC)."
(let (prefix time parts)
(setq parts (org-split-string id ":"))
(if (= 2 (length parts))