emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master fe110cb6115: Merge from origin/emacs-29


From: Eli Zaretskii
Subject: master fe110cb6115: Merge from origin/emacs-29
Date: Sat, 14 Oct 2023 06:56:44 -0400 (EDT)

branch: master
commit fe110cb61152c21a24f3c0ceaa00290884365b61
Merge: fbbe40cf50e 06a87738114
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Merge from origin/emacs-29
    
    06a87738114 ; * lisp/calendar/time-date.el (days-to-time): Doc fix.
    0ea2d6d9e82 Document that time-to-days and days-to-time use different...
---
 doc/lispref/os.texi        | 8 ++++++++
 lisp/calendar/time-date.el | 7 +++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index f92709f1f9b..5711ba9016a 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -2127,6 +2127,14 @@ This function returns the number of days between the 
beginning of year
 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.
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index 9cbe8e0f53c..319d1d1b91c 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -181,7 +181,10 @@ If DATE lacks timezone information, GMT is assumed."
 
 ;;;###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.
@@ -243,7 +246,7 @@ DATE1 and DATE2 should be date-time strings."
 
 ;;;###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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]