emacs-diffs
[Top][All Lists]
Advanced

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

master b376ed7: Default to 1970 in decoded-time-set-defaults


From: Basil L. Contovounesios
Subject: master b376ed7: Default to 1970 in decoded-time-set-defaults
Date: Sun, 9 May 2021 07:00:35 -0400 (EDT)

branch: master
commit b376ed72204193eba652666fa2540f412f456490
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Default to 1970 in decoded-time-set-defaults
    
    * lisp/calendar/time-date.el (decoded-time-set-defaults): Set an
    unspecified year field to 1970, as promised in the docstring, and to
    ensure it's representable on all systems (bug#48298).
---
 lisp/calendar/time-date.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index 2df57a3..1c169b7 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -525,6 +525,8 @@ changes in daylight saving time are not taken into account."
 (defun decoded-time-set-defaults (time &optional default-zone)
   "Set any nil values in `decoded-time' TIME to default values.
 The default value is based on January 1st, 1970 at midnight.
+This year is used to guarantee portability; see Info
+node `(elisp) Time of Day'.
 
 TIME is modified and returned."
   (unless (decoded-time-second time)
@@ -539,7 +541,7 @@ TIME is modified and returned."
   (unless (decoded-time-month time)
     (setf (decoded-time-month time) 1))
   (unless (decoded-time-year time)
-    (setf (decoded-time-year time) 0))
+    (setf (decoded-time-year time) 1970))
 
   ;; When we don't have a time zone, default to DEFAULT-ZONE without
   ;; DST if DEFAULT-ZONE if given, and to unknown DST otherwise.



reply via email to

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