The operating system limits the range of time and zone values.
@end defun
+@defun days-to-time days
+This is not quite the inverse of the @code{time-to-days} function, as
+it uses the Emacs epoch (instead of the year 1) for historical
+reasons. To get the inverse, subtract @code{(time-to-days 0)} from
+@var{days}, in which case @code{days-to-time} may return @code{nil} if
+@var{days} is negative.
+@end defun
+
@defun time-to-day-in-year time-value
This returns the day number within the year corresponding to @var{time-value},
assuming the default time zone.
;;;###autoload
(defun days-to-time (days)
- "Convert DAYS into a time value."
+ "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.
;;;###autoload
(defun time-to-days (time)
- "The absolute date corresponding to TIME, a time value.
+ "The absolute pseudo-Gregorian date for TIME, a time value.
The absolute date is the number of days elapsed since the imaginary
Gregorian date Sunday, December 31, 1 BC."
(let* ((tim (decode-time time))