aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/calendar/parse-time.el
diff options
context:
space:
mode:
authorPaul Eggert2018-09-21 14:24:42 -0700
committerPaul Eggert2018-09-21 14:25:19 -0700
commit0bec064454adac2bdff04a11bbdfaa79aa4ce052 (patch)
treeab85b4e46d2ab44dd3d02b85a5a540470842e470 /lisp/calendar/parse-time.el
parent167274d44f1ccaee65a5b68e15c3ed79a53447d1 (diff)
downloademacs-0bec064454adac2bdff04a11bbdfaa79aa4ce052.tar.gz
emacs-0bec064454adac2bdff04a11bbdfaa79aa4ce052.zip
Fix ambiguity in nil DST flag
Formerly nil meant both that DST was not in effect and that the DST flag was unknown, and different functions interpreted the flag differently. Now the meaning is consistently nil for DST not in effect, and -1 for DST flag not known. * doc/lispref/os.texi (Time Conversion): The DST slot is now three-valued, not two-. * doc/misc/emacs-mime.texi (time-date): Adjust to new behavior. * etc/NEWS: Mention this. * lisp/calendar/parse-time.el (parse-time-string): * src/editfns.c (Fdecode_time): Return -1 for unknown DST flag. * test/lisp/calendar/parse-time-tests.el (parse-time-tests): Adjust tests to match new behavior, and add a new test for nil vs -1.
Diffstat (limited to 'lisp/calendar/parse-time.el')
-rw-r--r--lisp/calendar/parse-time.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el
index 2f9e557dabc..d6c1e9ea169 100644
--- a/lisp/calendar/parse-time.el
+++ b/lisp/calendar/parse-time.el
@@ -29,8 +29,9 @@
29 29
30;; `parse-time-string' parses a time in a string and returns a list of 9 30;; `parse-time-string' parses a time in a string and returns a list of 9
31;; values, just like `decode-time', where unspecified elements in the 31;; values, just like `decode-time', where unspecified elements in the
32;; string are returned as nil. `encode-time' may be applied on these 32;; string are returned as nil (except unspecfied DST is returned as -1).
33;; values to obtain an internal time value. 33;; `encode-time' may be applied on these values to obtain an internal
34;; time value.
34 35
35;;; Code: 36;;; Code:
36 37
@@ -151,8 +152,9 @@ STRING should be on something resembling an RFC2822 string, a la
151somewhat liberal in what format it accepts, and will attempt to 152somewhat liberal in what format it accepts, and will attempt to
152return a \"likely\" value even for somewhat malformed strings. 153return a \"likely\" value even for somewhat malformed strings.
153The values returned are identical to those of `decode-time', but 154The values returned are identical to those of `decode-time', but
154any values that are unknown are returned as nil." 155any unknown values other than DST are returned as nil, and an
155 (let ((time (list nil nil nil nil nil nil nil nil nil)) 156unknown DST value is returned as -1."
157 (let ((time (list nil nil nil nil nil nil nil -1 nil))
156 (temp (parse-time-tokenize (downcase string)))) 158 (temp (parse-time-tokenize (downcase string))))
157 (while temp 159 (while temp
158 (let ((parse-time-elt (pop temp)) 160 (let ((parse-time-elt (pop temp))