diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2018-09-21 14:24:42 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2018-09-21 14:25:19 -0700 |
commit | 0bec064454adac2bdff04a11bbdfaa79aa4ce052 (patch) | |
tree | ab85b4e46d2ab44dd3d02b85a5a540470842e470 /lisp/calendar/parse-time.el | |
parent | 167274d44f1ccaee65a5b68e15c3ed79a53447d1 (diff) | |
download | emacs-0bec064454adac2bdff04a11bbdfaa79aa4ce052.tar.gz |
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.el | 10 |
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 @@ ;; `parse-time-string' parses a time in a string and returns a list of 9 ;; values, just like `decode-time', where unspecified elements in the -;; string are returned as nil. `encode-time' may be applied on these -;; values to obtain an internal time value. +;; string are returned as nil (except unspecfied DST is returned as -1). +;; `encode-time' may be applied on these values to obtain an internal +;; time value. ;;; Code: @@ -151,8 +152,9 @@ STRING should be on something resembling an RFC2822 string, a la somewhat liberal in what format it accepts, and will attempt to return a \"likely\" value even for somewhat malformed strings. The values returned are identical to those of `decode-time', but -any values that are unknown are returned as nil." - (let ((time (list nil nil nil nil nil nil nil nil nil)) +any unknown values other than DST are returned as nil, and an +unknown DST value is returned as -1." + (let ((time (list nil nil nil nil nil nil nil -1 nil)) (temp (parse-time-tokenize (downcase string)))) (while temp (let ((parse-time-elt (pop temp)) |