Use `org-encode-time' helper macro

* lisp/ol.el (org-store-link):
* lisp/org-agenda.el (org-agenda-get-timestamps)
(org-agenda-get-progress, agenda-bulk-action):
* lisp/org-capture.el (org-capture-fill-template):
* lisp/org-clock.el (org-clock-get-sum-start)
(org-clock-special-range, org-clocktable-shift)
(org-clocktable-steps):
* lisp/org-colview.el (org-colview-construct-allowed-dates):
* lisp/org-datetree.el (org-datetree-find-iso-week-create)
(org-datetree-insert-line):
* lisp/org-element.el (org-element-timestamp-interpreter):
* lisp/org-macro.el (org-macro--vc-modified-time):
* lisp/org-macs.el (org-matcher-time):
* lisp/org.el (org-current-time, org-current-effective-time)
(org-add-planning-info, org-read-date, org-read-date-display)
(org-read-date-analyze, org-eval-in-calendar)
(org-calendar-select, org-display-custom-time)
(org-calendar-select-mouse, org-time-string-to-time)
(org-time-from-absolute, org-at-clock-log-p)
(org-date-from-calendar, org-get-cursor-date)
(org-timestamp-to-time):
* testing/lisp/test-org-clock.el (org-test-clock-create-timestamp):
* lisp/ox-icalendar.el (org-icalendar-convert-timestamp):
Avoid direct calls of `encode-time', use `org-encode-time' instead.

Org supports Emacs-26, but the recommended way to call `encode-time'
changed in Emacs-27.  In Emacs-29 DST and TZ elements of the single list
arguments became optional.  In Org it is still convenient to call the
function with separate arguments without explicit DST and TZ arguments.
The `org-encode-time' should mitigate attempts to modernize Org code
directly in the Emacs repository.
This commit is contained in:
Max Nikulin 2022-05-02 21:19:59 +07:00 committed by Ihor Radchenko
parent 8908a1bda1
commit ae1db7df39
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
12 changed files with 108 additions and 100 deletions

View File

@ -1618,7 +1618,7 @@ non-nil."
(setq link
(format-time-string
(car org-time-stamp-formats)
(encode-time 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd))))
(org-encode-time 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd))))
(org-link-store-props :type "calendar" :date cd)))
((eq major-mode 'w3-mode)

View File

@ -5758,7 +5758,7 @@ displayed in agenda view."
(substring
(format-time-string
(car org-time-stamp-formats)
(encode-time ; DATE bound by calendar
(org-encode-time ; DATE bound by calendar
0 0 0 (nth 1 date) (car date) (nth 2 date)))
1 11))
"\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[hdwmy]>\\)"
@ -6030,7 +6030,7 @@ then those holidays will be skipped."
(substring
(format-time-string
(car org-time-stamp-formats)
(encode-time ; DATE bound by calendar
(org-encode-time ; DATE bound by calendar
0 0 0 (nth 1 date) (car date) (nth 2 date)))
1 11))))
(org-agenda-search-headline-for-time nil)
@ -11119,8 +11119,8 @@ The prefix arg is passed through to the command if possible."
(ignore-errors
(let* ((date (calendar-gregorian-from-absolute
(+ (org-today) distance)))
(time (encode-time 0 0 0 (nth 1 date) (nth 0 date)
(nth 2 date))))
(time (org-encode-time
0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
(org-agenda-schedule nil time))))))))
(?f

View File

@ -1052,9 +1052,10 @@ Store them in the capture property list."
prompt-time
;; Use 00:00 when no time is given for another
;; date than today?
(apply #'encode-time 0 0
org-extend-today-until
(cl-cdddr (decode-time prompt-time)))))
(org-encode-time
(apply #'list
0 0 org-extend-today-until
(cl-cdddr (decode-time prompt-time))))))
(time-to-days prompt-time)))
(t
;; Current date, possibly corrected for late night
@ -1583,7 +1584,7 @@ Expansion occurs in a temporary Org mode buffer."
(time (let* ((c (or (org-capture-get :default-time) (current-time)))
(d (decode-time c)))
(if (< (nth 2 d) org-extend-today-until)
(encode-time 0 59 23 (1- (nth 3 d)) (nth 4 d) (nth 5 d))
(org-encode-time 0 59 23 (1- (nth 3 d)) (nth 4 d) (nth 5 d))
c)))
(v-t (format-time-string (org-time-stamp-format nil) time))
(v-T (format-time-string (org-time-stamp-format t) time))

View File

@ -1519,7 +1519,7 @@ The time is always returned as UTC."
(day (nth 3 dt)))
(if (< hour org-extend-today-until) (setf (nth 3 dt) (1- day)))
(setf (nth 2 dt) org-extend-today-until)
(apply #'encode-time 0 0 (nthcdr 2 dt))))
(org-encode-time (apply #'list 0 0 (nthcdr 2 dt)))))
((or (equal cmt "all")
(and (or (not cmt) (equal cmt "auto"))
(not lr)))
@ -2352,16 +2352,16 @@ have priority."
(let* ((start (pcase key
(`interactive (org-read-date nil t nil "Range start? "))
(`untilnow nil)
(_ (encode-time 0 m h d month y))))
(_ (org-encode-time 0 m h d month y))))
(end (pcase key
(`interactive (org-read-date nil t nil "Range end? "))
(`untilnow (current-time))
(_ (encode-time 0
m ;; (or m1 m)
(or h1 h)
(or d1 d)
(or month1 month)
(or y1 y)))))
(_ (org-encode-time 0
m ;; (or m1 m)
(or h1 h)
(or d1 d)
(or month1 month)
(or y1 y)))))
(text
(pcase key
((or `day `today) (format-time-string "%A, %B %d, %Y" start))
@ -2429,14 +2429,14 @@ the currently selected interval size."
(cond
(d (setq ins (format-time-string
"%Y-%m-%d"
(encode-time 0 0 0 (+ d n) nil y)))) ;; m
(org-encode-time 0 0 0 (+ d n) nil y)))) ;; m
((and wp (string-match "w\\|W" wp) mw (> (length wp) 0))
(require 'cal-iso)
(setq date (calendar-gregorian-from-absolute
(calendar-iso-to-absolute (list (+ mw n) 1 y))))
(setq ins (format-time-string
"%G-W%V"
(encode-time 0 0 0 (nth 1 date) (car date) (nth 2 date)))))
(org-encode-time 0 0 0 (nth 1 date) (car date) (nth 2 date)))))
((and wp (string-match "q\\|Q" wp) mw (> (length wp) 0))
(require 'cal-iso)
; if the 4th + 1 quarter is requested we flip to the 1st quarter of the next year
@ -2453,11 +2453,11 @@ the currently selected interval size."
(calendar-iso-to-absolute (org-quarter-to-date (+ mw n) y))))
(setq ins (format-time-string
(concat (number-to-string y) "-Q" (number-to-string (+ mw n)))
(encode-time 0 0 0 (nth 1 date) (car date) (nth 2 date)))))
(org-encode-time 0 0 0 (nth 1 date) (car date) (nth 2 date)))))
(mw
(setq ins (format-time-string
"%Y-%m"
(encode-time 0 0 0 1 (+ mw n) y))))
(org-encode-time 0 0 0 1 (+ mw n) y))))
(y
(setq ins (number-to-string (+ y n))))))
(t (user-error "Cannot shift clocktable block")))
@ -2845,7 +2845,7 @@ a number of clock tables."
(pcase (if range (car range) (plist-get params :tstart))
((and (pred numberp) n)
(pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n)))
(apply #'encode-time (list 0 0 org-extend-today-until d m y))))
(org-encode-time 0 0 org-extend-today-until d m y)))
(timestamp
(seconds-to-time
(org-matcher-time (or timestamp
@ -2855,7 +2855,7 @@ a number of clock tables."
(pcase (if range (nth 1 range) (plist-get params :tend))
((and (pred numberp) n)
(pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n)))
(apply #'encode-time (list 0 0 org-extend-today-until d m y))))
(org-encode-time 0 0 org-extend-today-until d m y)))
(timestamp (seconds-to-time (org-matcher-time timestamp))))))
(while (time-less-p start end)
(unless (bolp) (insert "\n"))
@ -2867,20 +2867,21 @@ a number of clock tables."
;; Compute NEXT, which is the end of the current clock table,
;; according to step.
(let* ((next
(apply #'encode-time
(pcase-let
((`(,_ ,_ ,_ ,d ,m ,y ,dow . ,_) (decode-time start)))
(pcase step
(`day (list 0 0 org-extend-today-until (1+ d) m y))
(`week
(let ((offset (if (= dow week-start) 7
(mod (- week-start dow) 7))))
(list 0 0 org-extend-today-until (+ d offset) m y)))
(`semimonth (list 0 0 0
(if (< d 16) 16 1)
(if (< d 16) m (1+ m)) y))
(`month (list 0 0 0 month-start (1+ m) y))
(`year (list 0 0 org-extend-today-until 1 1 (1+ y)))))))
;; In Emacs-27 and Emacs-28 `encode-time' does not support 6 elements
;; list argument so `org-encode-time' can not be outside of `pcase'.
(pcase-let
((`(,_ ,_ ,_ ,d ,m ,y ,dow . ,_) (decode-time start)))
(pcase step
(`day (org-encode-time 0 0 org-extend-today-until (1+ d) m y))
(`week
(let ((offset (if (= dow week-start) 7
(mod (- week-start dow) 7))))
(org-encode-time 0 0 org-extend-today-until (+ d offset) m y)))
(`semimonth (org-encode-time 0 0 0
(if (< d 16) 16 1)
(if (< d 16) m (1+ m)) y))
(`month (org-encode-time 0 0 0 month-start (1+ m) y))
(`year (org-encode-time 0 0 org-extend-today-until 1 1 (1+ y))))))
(table-begin (line-beginning-position 0))
(step-time
;; Write clock table between START and NEXT.

View File

@ -783,7 +783,7 @@ around it."
(setq time-after (copy-sequence time))
(setf (nth 3 time-before) (1- (nth 3 time)))
(setf (nth 3 time-after) (1+ (nth 3 time)))
(mapcar (lambda (x) (format-time-string fmt (apply #'encode-time x)))
(mapcar (lambda (x) (format-time-string fmt (org-encode-time x)))
(list time-before time time-after)))))
(defun org-columns-open-link (&optional arg)

View File

@ -137,7 +137,7 @@ will be built under the headline at point."
(let* ((year (calendar-extract-year d))
(month (calendar-extract-month d))
(day (calendar-extract-day d))
(time (encode-time 0 0 0 day month year))
(time (org-encode-time 0 0 0 day month year))
(iso-date (calendar-iso-from-absolute
(calendar-absolute-from-gregorian d)))
(weekyear (nth 2 iso-date))
@ -197,14 +197,14 @@ inserted into the buffer."
(when month
(insert
(if day
(format-time-string "-%m-%d %A" (encode-time 0 0 0 day month year))
(format-time-string "-%m %B" (encode-time 0 0 0 1 month year))))))
(format-time-string "-%m-%d %A" (org-encode-time 0 0 0 day month year))
(format-time-string "-%m %B" (org-encode-time 0 0 0 1 month year))))))
(when (and day org-datetree-add-timestamp)
(save-excursion
(insert "\n")
(org-indent-line)
(org-insert-time-stamp
(encode-time 0 0 0 day month year)
(org-encode-time 0 0 0 day month year)
nil
(eq org-datetree-add-timestamp 'inactive))))
(beginning-of-line))

View File

@ -4046,12 +4046,12 @@ Assume point is at the beginning of the timestamp."
(/= minute-start minute-end)))))
(funcall
build-ts-string
(encode-time 0
(or minute-start 0)
(or hour-start 0)
(org-element-property :day-start timestamp)
(org-element-property :month-start timestamp)
(org-element-property :year-start timestamp))
(org-encode-time 0
(or minute-start 0)
(or hour-start 0)
(org-element-property :day-start timestamp)
(org-element-property :month-start timestamp)
(org-element-property :year-start timestamp))
(eq type 'active)
(and hour-start minute-start)
(and time-range-p hour-end)
@ -4063,7 +4063,7 @@ Assume point is at the beginning of the timestamp."
(hour-end (org-element-property :hour-end timestamp)))
(concat
(funcall
build-ts-string (encode-time
build-ts-string (org-encode-time
0
(or minute-start 0)
(or hour-start 0)
@ -4074,12 +4074,13 @@ Assume point is at the beginning of the timestamp."
(and hour-start minute-start))
"--"
(funcall build-ts-string
(encode-time 0
(or minute-end 0)
(or hour-end 0)
(org-element-property :day-end timestamp)
(org-element-property :month-end timestamp)
(org-element-property :year-end timestamp))
(org-encode-time
0
(or minute-end 0)
(or hour-end 0)
(org-element-property :day-end timestamp)
(org-element-property :month-end timestamp)
(org-element-property :year-end timestamp))
(eq type 'active-range)
(and hour-end minute-end)))))
(_ (org-element-property :raw-value timestamp)))))

View File

@ -387,7 +387,7 @@ Return value as a string."
(buffer-substring
(point) (line-end-position)))))
(when (cl-some #'identity time)
(setq date (apply #'encode-time time))))))))
(setq date (org-encode-time time))))))))
(let ((proc (get-buffer-process buf)))
(while (and proc (accept-process-output proc .5 nil t)))))
(kill-buffer buf))

View File

@ -1460,8 +1460,8 @@ following special strings: \"<now>\", \"<today>\",
\"<tomorrow>\", and \"<yesterday>\".
Return 0. if S is not recognized as a valid value."
(let ((today (float-time (apply #'encode-time
(append '(0 0 0) (nthcdr 3 (decode-time)))))))
(let ((today (float-time (org-encode-time
(append '(0 0 0) (nthcdr 3 (decode-time)))))))
(save-match-data
(cond
((string= s "<now>") (float-time))

View File

@ -4905,8 +4905,10 @@ the rounding returns a past time."
(if (< r 1)
now
(let* ((time (decode-time now))
(res (apply #'encode-time 0 (* r (round (nth 1 time) r))
(nthcdr 2 time))))
(res (org-encode-time
(apply #'list
0 (* r (round (nth 1 time) r))
(nthcdr 2 time)))))
(if (or (not past) (time-less-p res now))
res
(time-subtract res (* r 60)))))))
@ -8932,7 +8934,7 @@ nil or a string to be used for the todo mark." )
(org-use-last-clock-out-time-as-effective-time
(or (org-clock-get-last-clock-out-time) ct))
((and org-use-effective-time (< (nth 2 dct) org-extend-today-until))
(encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct)))
(org-encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct)))
(t ct))))
ct1))
@ -10091,9 +10093,9 @@ WHAT entry will also be removed."
(if (stringp time)
;; This is a string (relative or absolute), set
;; proper date.
(apply #'encode-time
(org-read-date-analyze
time default-time (decode-time default-time)))
(org-encode-time
(org-read-date-analyze
time default-time (decode-time default-time)))
;; If necessary, get the time from the user
(or time (org-read-date nil 'to-time nil
(cl-case what
@ -13481,7 +13483,7 @@ user."
(when (< (nth 2 org-defdecode) org-extend-today-until)
(setf (nth 2 org-defdecode) -1)
(setf (nth 1 org-defdecode) 59)
(setq org-def (apply #'encode-time org-defdecode))
(setq org-def (org-encode-time org-defdecode))
(setq org-defdecode (decode-time org-def)))
(let* ((timestr (format-time-string
(if org-with-time "%Y-%m-%d %H:%M" "%Y-%m-%d")
@ -13554,7 +13556,7 @@ user."
"range representable on this machine"))
(ding))
(setq final (apply #'encode-time final))
(setq final (org-encode-time final))
(setq org-read-date-final-answer ans)
@ -13591,7 +13593,7 @@ user."
(and (boundp 'org-time-was-given) org-time-was-given))
(cdr fmts)
(car fmts)))
(txt (format-time-string fmt (apply #'encode-time f)))
(txt (format-time-string fmt (org-encode-time f)))
(txt (if org-read-date-inactive (concat "[" (substring txt 1 -1) "]") txt))
(txt (concat "=> " txt)))
(when (and org-end-time-was-given
@ -13813,7 +13815,7 @@ user."
((and wday (not (nth 3 tl)))
;; Weekday was given, but no day, so pick that day in the week
;; on or after the derived date.
(setq wday1 (nth 6 (decode-time (encode-time 0 0 0 day month year))))
(setq wday1 (nth 6 (decode-time (org-encode-time 0 0 0 day month year))))
(unless (equal wday wday1)
(setq day (+ day (% (- wday wday1 -7) 7))))))
(when (and (boundp 'org-time-was-given)
@ -13828,7 +13830,7 @@ user."
(when (> year 2037)
(setq year 2037 org-read-date-analyze-forced-year t)))
(condition-case nil
(ignore (encode-time second minute hour day month year))
(ignore (org-encode-time second minute hour day month year))
(error
(setq year (nth 5 org-defdecode))
(setq org-read-date-analyze-forced-year t))))
@ -13893,7 +13895,7 @@ Unless KEEPDATE is non-nil, update `org-ans2' to the cursor date."
(eval form t)
(when (and (not keepdate) (calendar-cursor-to-date))
(let* ((date (calendar-cursor-to-date))
(time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
(time (org-encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
(setq org-ans2 (format-time-string "%Y-%m-%d" time))))
(move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer))
(select-window sw)
@ -13905,7 +13907,7 @@ This is used by `org-read-date' in a temporary keymap for the calendar buffer."
(interactive)
(when (calendar-cursor-to-date)
(let* ((date (calendar-cursor-to-date))
(time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
(time (org-encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
(setq org-ans1 (format-time-string "%Y-%m-%d" time)))
(when (active-minibuffer-window) (exit-minibuffer))))
@ -13970,7 +13972,7 @@ The command returns the inserted time stamp."
time (org-fix-decoded-time t1)
str (org-add-props
(format-time-string
(substring tf 1 -1) (apply 'encode-time time))
(substring tf 1 -1) (org-encode-time time))
nil 'mouse-face 'highlight))
(put-text-property beg end 'display str)))
@ -14024,7 +14026,7 @@ This is used by `org-read-date' in a temporary keymap for the calendar buffer."
(mouse-set-point ev)
(when (calendar-cursor-to-date)
(let* ((date (calendar-cursor-to-date))
(time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
(time (org-encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
(setq org-ans1 (format-time-string "%Y-%m-%d" time)))
(when (active-minibuffer-window) (exit-minibuffer))))
@ -14225,7 +14227,7 @@ days in order to avoid rounding problems."
(defun org-time-string-to-time (s)
"Convert timestamp string S into internal time."
(apply #'encode-time (org-parse-time-string s)))
(org-encode-time (org-parse-time-string s)))
(defun org-time-string-to-seconds (s)
"Convert a timestamp string S into a number of seconds."
@ -14288,7 +14290,7 @@ into a past one. Any year larger than 99 is returned unchanged."
"Return the time corresponding to date D.
D may be an absolute day number, or a calendar-type list (month day year)."
(when (numberp d) (setq d (calendar-gregorian-from-absolute d)))
(encode-time 0 0 0 (nth 1 d) (car d) (nth 2 d)))
(org-encode-time 0 0 0 (nth 1 d) (car d) (nth 2 d)))
(defvar org-agenda-current-date)
(defun org-calendar-holiday ()
@ -14642,14 +14644,15 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like
(setcar (cdr time0) (+ (nth 1 time0)
(if (> n 0) (- rem) (- dm rem))))))
(setq time
(apply #'encode-time
(or (car time0) 0)
(+ (if (eq timestamp? 'minute) n 0) (nth 1 time0))
(+ (if (eq timestamp? 'hour) n 0) (nth 2 time0))
(+ (if (eq timestamp? 'day) n 0) (nth 3 time0))
(+ (if (eq timestamp? 'month) n 0) (nth 4 time0))
(+ (if (eq timestamp? 'year) n 0) (nth 5 time0))
(nthcdr 6 time0)))
(org-encode-time
(apply #'list
(or (car time0) 0)
(+ (if (eq timestamp? 'minute) n 0) (nth 1 time0))
(+ (if (eq timestamp? 'hour) n 0) (nth 2 time0))
(+ (if (eq timestamp? 'day) n 0) (nth 3 time0))
(+ (if (eq timestamp? 'month) n 0) (nth 4 time0))
(+ (if (eq timestamp? 'year) n 0) (nth 5 time0))
(nthcdr 6 time0))))
(when (and (memq timestamp? '(hour minute))
extra
(string-match "-\\([012][0-9]\\):\\([0-5][0-9]\\)" extra))
@ -14667,7 +14670,7 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like
(setcar time0 (or (car time0) 0))
(setcar (nthcdr 1 time0) (or (nth 1 time0) 0))
(setcar (nthcdr 2 time0) (or (nth 2 time0) 0))
(setq time (apply 'encode-time time0))))
(setq time (org-encode-time time0))))
;; Insert the new time-stamp, and ensure point stays in the same
;; category as before (i.e. not after the last position in that
;; category).
@ -14813,7 +14816,7 @@ If there is already a time stamp at the cursor position, update it."
(org-timestamp-change 0 'calendar)
(let ((cal-date (org-get-date-from-calendar)))
(org-insert-time-stamp
(encode-time 0 0 0 (nth 1 cal-date) (car cal-date) (nth 2 cal-date))))))
(org-encode-time 0 0 0 (nth 1 cal-date) (car cal-date) (nth 2 cal-date))))))
(defcustom org-image-actual-width t
"When non-nil, use the actual width of images when inlining them.
@ -18378,14 +18381,14 @@ earliest time on the cursor date that Org treats as that date
(cond
((eq major-mode 'calendar-mode)
(setq date (calendar-cursor-to-date)
defd (encode-time 0 (or mod 0) (or hod org-extend-today-until)
(nth 1 date) (nth 0 date) (nth 2 date))))
defd (org-encode-time 0 (or mod 0) (or hod org-extend-today-until)
(nth 1 date) (nth 0 date) (nth 2 date))))
((eq major-mode 'org-agenda-mode)
(setq day (get-text-property (point) 'day))
(when day
(setq date (calendar-gregorian-from-absolute day)
defd (encode-time 0 (or mod 0) (or hod org-extend-today-until)
(nth 1 date) (nth 0 date) (nth 2 date))))))
defd (org-encode-time 0 (or mod 0) (or hod org-extend-today-until)
(nth 1 date) (nth 0 date) (nth 2 date))))))
(or defd (current-time))))
(defun org-mark-subtree (&optional up)
@ -19456,12 +19459,14 @@ return an active timestamp."
"Convert TIMESTAMP object into an Emacs internal time value.
Use end of date range or time range when END is non-nil.
Otherwise, use its start."
(apply #'encode-time 0
(mapcar
(lambda (prop) (or (org-element-property prop timestamp) 0))
(if end '(:minute-end :hour-end :day-end :month-end :year-end)
'(:minute-start :hour-start :day-start :month-start
:year-start)))))
(org-encode-time
(append '(0)
(mapcar
(lambda (prop) (or (org-element-property prop timestamp) 0))
(if end '(:minute-end :hour-end :day-end :month-end :year-end)
'(:minute-start :hour-start :day-start :month-start
:year-start)))
'(nil -1 nil))))
(defun org-timestamp-has-time-p (timestamp)
"Non-nil when TIMESTAMP has a time specified."

View File

@ -433,7 +433,7 @@ format (e.g. \"Europe/London\"). In either case, the value of
t)))
;; Convert timestamp into internal time in order to use
;; `format-time-string' and fix any mistake (i.e. MI >= 60).
(encode-time 0 mi h d m y)
(org-encode-time 0 mi h d m y)
(and (or (string-equal tz "UTC")
(and (null tz)
with-time-p

View File

@ -26,10 +26,10 @@ insert hours and minutes.
Return the timestamp as a string."
(org-element-interpret-data
(let ((time (decode-time
(apply #'encode-time
(org-fix-decoded-time
(org-read-date-analyze
input nil (decode-time (current-time))))))))
(org-encode-time
(org-fix-decoded-time
(org-read-date-analyze
input nil (decode-time (current-time))))))))
(list 'timestamp
(list :type (if inactive 'inactive 'active)
:minute-start (and with-time (nth 1 time))