Function: days-to-time

days-to-time is an autoloaded and byte-compiled function defined in time-date.el.gz.

Signature

(days-to-time DAYS)

Documentation

Convert Emacs-epoch DAYS into a time value.

Note that this does not use the same epoch as time-to-days; you must subtract (time-to-days 0) first to convert, and may get nil if the result is before the start.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/time-date.el.gz
;;;###autoload
(defun days-to-time (days)
  "Convert Emacs-epoch DAYS into a time value.
Note that this does not use the same epoch as `time-to-days'; you
must subtract (time-to-days 0) first to convert, and may get nil
if the result is before the start."
  ;; FIXME: We should likely just pass `t' to `time-convert'.
  ;; All uses I could find in Emacs, GNU ELPA, and NonGNU ELPA can handle
  ;; any valid time representation as return value.
  (let ((time (time-convert (* 86400 days) 'list)))
    ;; Traditionally, this returned a two-element list if DAYS was an integer.
    ;; Keep that tradition if time-convert outputs timestamps in list form.
    (if (and (integerp days) (consp (cdr time)))
	(setcdr (cdr time) nil))
    time))