Browse Source

Backport commit 5f3f3884a from Emacs

Improve time function doc
5f3f3884a0d2a88101d330b82ef5b584cfc02aa6
Paul Eggert
Sun Aug 4 10:09:25 2019 -0700
Paul Eggert 5 years ago
parent
commit
71ce18920a
1 changed files with 5 additions and 2 deletions
  1. 5 2
      lisp/org-id.el

+ 5 - 2
lisp/org-id.el

@@ -413,9 +413,12 @@ The input I may be a character, or a single-letter string."
     r))
     r))
 
 
 (defun org-id-time-to-b36 (&optional time)
 (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
 This string holds the time to micro-second accuracy, and can be decoded
 using `org-id-decode'."
 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 (or time (org-current-time-as-list)))
   (concat (org-id-int-to-b36 (nth 0 time) 4)
   (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 1 time) 4)
@@ -424,7 +427,7 @@ using `org-id-decode'."
 (defun org-id-decode (id)
 (defun org-id-decode (id)
   "Split ID into the prefix and the time value that was used to create it.
   "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,
 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)
   (let (prefix time parts)
     (setq parts (org-split-string id ":"))
     (setq parts (org-split-string id ":"))
     (if (= 2 (length parts))
     (if (= 2 (length parts))