Function: org-encode-time
org-encode-time is a macro defined in org-macs.el.gz.
Signature
(org-encode-time &rest TIME)
Documentation
Compatibility and convenience helper for encode-time.
TIME may be a 9 components list (SECONDS ... YEAR IGNORED DST ZONE)
as the recommended way since Emacs-27 or 6 or 9 separate arguments
similar to the only possible variant for Emacs-26 and earlier.
6 elements list as the only argument causes wrong type argument till
Emacs-29.
Warning: use -1 for DST to guess the actual value, nil means no daylight saving time and may be wrong at particular time.
DST value is ignored prior to Emacs-27. Since Emacs-27 DST value matters
even when multiple arguments is passed to this macro and such
behavior is different from encode-time. See
Info node (elisp)Time Conversion for details and caveats,
preferably the latest version.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-macs.el.gz
(defmacro org-encode-time (&rest time)
"Compatibility and convenience helper for `encode-time'.
TIME may be a 9 components list (SECONDS ... YEAR IGNORED DST ZONE)
as the recommended way since Emacs-27 or 6 or 9 separate arguments
similar to the only possible variant for Emacs-26 and earlier.
6 elements list as the only argument causes wrong type argument till
Emacs-29.
Warning: use -1 for DST to guess the actual value, nil means no
daylight saving time and may be wrong at particular time.
DST value is ignored prior to Emacs-27. Since Emacs-27 DST value matters
even when multiple arguments is passed to this macro and such
behavior is different from `encode-time'. See
Info node `(elisp)Time Conversion' for details and caveats,
preferably the latest version."
(if (version< emacs-version "27.1")
(if (cdr time)
`(encode-time ,@time)
`(apply #'encode-time ,@time))
(if (ignore-errors (with-no-warnings (encode-time '(0 0 0 1 1 1971))))
(pcase (length time) ; Emacs-29 since d75e2c12eb
(1 `(encode-time ,@time))
((or 6 9) `(encode-time (list ,@time)))
(_ (error "`org-encode-time' may be called with 1, 6, or 9 arguments but %d given"
(length time))))
(pcase (length time)
(1 `(encode-time ,@time))
(6 `(encode-time (list ,@time nil -1 nil)))
(9 `(encode-time (list ,@time)))
(_ (error "`org-encode-time' may be called with 1, 6, or 9 arguments but %d given"
(length time)))))))