diff options
| -rw-r--r-- | doc/lispref/os.texi | 3 | ||||
| -rw-r--r-- | doc/misc/emacs-mime.texi | 2 | ||||
| -rw-r--r-- | etc/NEWS | 8 | ||||
| -rw-r--r-- | lisp/calendar/parse-time.el | 10 | ||||
| -rw-r--r-- | src/editfns.c | 6 | ||||
| -rw-r--r-- | test/lisp/calendar/parse-time-tests.el | 20 |
6 files changed, 32 insertions, 17 deletions
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 0b9dd1c9cc3..43ca9ede00b 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi | |||
| @@ -1423,7 +1423,8 @@ The year, an integer typically greater than 1900. | |||
| 1423 | The day of week, as an integer between 0 and 6, where 0 stands for | 1423 | The day of week, as an integer between 0 and 6, where 0 stands for |
| 1424 | Sunday. | 1424 | Sunday. |
| 1425 | @item dst | 1425 | @item dst |
| 1426 | @code{t} if daylight saving time is effect, otherwise @code{nil}. | 1426 | @code{t} if daylight saving time is effect, @code{nil} if it is not |
| 1427 | in effect, and @minus{}1 if this information is not available. | ||
| 1427 | @item utcoff | 1428 | @item utcoff |
| 1428 | An integer indicating the Universal Time offset in seconds, i.e., the number of | 1429 | An integer indicating the Universal Time offset in seconds, i.e., the number of |
| 1429 | seconds east of Greenwich. | 1430 | seconds east of Greenwich. |
diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi index b71cc3755bf..45f37fb8557 100644 --- a/doc/misc/emacs-mime.texi +++ b/doc/misc/emacs-mime.texi | |||
| @@ -1535,7 +1535,7 @@ Here's a bunch of time/date/second/day examples: | |||
| 1535 | 1535 | ||
| 1536 | @example | 1536 | @example |
| 1537 | (parse-time-string "Sat Sep 12 12:21:54 1998 +0200") | 1537 | (parse-time-string "Sat Sep 12 12:21:54 1998 +0200") |
| 1538 | @result{} (54 21 12 12 9 1998 6 nil 7200) | 1538 | @result{} (54 21 12 12 9 1998 6 -1 7200) |
| 1539 | 1539 | ||
| 1540 | (date-to-time "Sat Sep 12 12:21:54 1998 +0200") | 1540 | (date-to-time "Sat Sep 12 12:21:54 1998 +0200") |
| 1541 | @result{} (13818 19266) | 1541 | @result{} (13818 19266) |
| @@ -1060,6 +1060,14 @@ a multibyte string even if its second argument is an ASCII character. | |||
| 1060 | ** (format "%d" X) no longer mishandles a floating-point number X that | 1060 | ** (format "%d" X) no longer mishandles a floating-point number X that |
| 1061 | does not fit in a machine integer. | 1061 | does not fit in a machine integer. |
| 1062 | 1062 | ||
| 1063 | +++ | ||
| 1064 | ** In the DST slot, encode-time and parse-time-string now return -1 | ||
| 1065 | if it is not known whether daylight saving time is in effect. | ||
| 1066 | Formerly they were inconsistent: encode-time returned t in this | ||
| 1067 | situation, whereas parse-time-string returned nil. Now they | ||
| 1068 | consistently use use nil to mean that DST is not in effect, and use -1 | ||
| 1069 | to mean that it is not known whether DST is in effect. | ||
| 1070 | |||
| 1063 | ** New JSON parsing and serialization functions 'json-serialize', | 1071 | ** New JSON parsing and serialization functions 'json-serialize', |
| 1064 | 'json-insert', 'json-parse-string', and 'json-parse-buffer'. These | 1072 | 'json-insert', 'json-parse-string', and 'json-parse-buffer'. These |
| 1065 | are implemented in C using the Jansson library. | 1073 | are implemented in C using the Jansson library. |
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 | |||
| 151 | somewhat liberal in what format it accepts, and will attempt to | 152 | somewhat liberal in what format it accepts, and will attempt to |
| 152 | return a \"likely\" value even for somewhat malformed strings. | 153 | return a \"likely\" value even for somewhat malformed strings. |
| 153 | The values returned are identical to those of `decode-time', but | 154 | The values returned are identical to those of `decode-time', but |
| 154 | any values that are unknown are returned as nil." | 155 | any unknown values other than DST are returned as nil, and an |
| 155 | (let ((time (list nil nil nil nil nil nil nil nil nil)) | 156 | unknown 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)) |
diff --git a/src/editfns.c b/src/editfns.c index 8c7491beedc..047a73f0b8c 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -2165,7 +2165,8 @@ between 0 and 23. DAY is an integer between 1 and 31. MONTH is an | |||
| 2165 | integer between 1 and 12. YEAR is an integer indicating the | 2165 | integer between 1 and 12. YEAR is an integer indicating the |
| 2166 | four-digit year. DOW is the day of week, an integer between 0 and 6, | 2166 | four-digit year. DOW is the day of week, an integer between 0 and 6, |
| 2167 | where 0 is Sunday. DST is t if daylight saving time is in effect, | 2167 | where 0 is Sunday. DST is t if daylight saving time is in effect, |
| 2168 | otherwise nil. UTCOFF is an integer indicating the UTC offset in | 2168 | nil if it is not in effect, and -1 if this information is |
| 2169 | not available. UTCOFF is an integer indicating the UTC offset in | ||
| 2169 | seconds, i.e., the number of seconds east of Greenwich. (Note that | 2170 | seconds, i.e., the number of seconds east of Greenwich. (Note that |
| 2170 | Common Lisp has different meanings for DOW and UTCOFF.) | 2171 | Common Lisp has different meanings for DOW and UTCOFF.) |
| 2171 | 2172 | ||
| @@ -2194,7 +2195,8 @@ usage: (decode-time &optional TIME ZONE) */) | |||
| 2194 | make_fixnum (local_tm.tm_mon + 1), | 2195 | make_fixnum (local_tm.tm_mon + 1), |
| 2195 | make_fixnum (local_tm.tm_year + tm_year_base), | 2196 | make_fixnum (local_tm.tm_year + tm_year_base), |
| 2196 | make_fixnum (local_tm.tm_wday), | 2197 | make_fixnum (local_tm.tm_wday), |
| 2197 | local_tm.tm_isdst ? Qt : Qnil, | 2198 | (local_tm.tm_isdst < 0 ? make_fixnum (-1) |
| 2199 | : local_tm.tm_isdst == 0 ? Qnil : Qt), | ||
| 2198 | (HAVE_TM_GMTOFF | 2200 | (HAVE_TM_GMTOFF |
| 2199 | ? make_fixnum (tm_gmtoff (&local_tm)) | 2201 | ? make_fixnum (tm_gmtoff (&local_tm)) |
| 2200 | : gmtime_r (&time_spec, &gmt_tm) | 2202 | : gmtime_r (&time_spec, &gmt_tm) |
diff --git a/test/lisp/calendar/parse-time-tests.el b/test/lisp/calendar/parse-time-tests.el index 3a956a56621..9689997f793 100644 --- a/test/lisp/calendar/parse-time-tests.el +++ b/test/lisp/calendar/parse-time-tests.el | |||
| @@ -28,21 +28,23 @@ | |||
| 28 | 28 | ||
| 29 | (ert-deftest parse-time-tests () | 29 | (ert-deftest parse-time-tests () |
| 30 | (should (equal (parse-time-string "Mon, 22 Feb 2016 19:35:42 +0100") | 30 | (should (equal (parse-time-string "Mon, 22 Feb 2016 19:35:42 +0100") |
| 31 | '(42 35 19 22 2 2016 1 nil 3600))) | 31 | '(42 35 19 22 2 2016 1 -1 3600))) |
| 32 | (should (equal (parse-time-string "22 Feb 2016 19:35:42 +0100") | 32 | (should (equal (parse-time-string "22 Feb 2016 19:35:42 +0100") |
| 33 | '(42 35 19 22 2 2016 nil nil 3600))) | 33 | '(42 35 19 22 2 2016 nil -1 3600))) |
| 34 | (should (equal (parse-time-string "22 Feb 2016 +0100") | 34 | (should (equal (parse-time-string "22 Feb 2016 +0100") |
| 35 | '(nil nil nil 22 2 2016 nil nil 3600))) | 35 | '(nil nil nil 22 2 2016 nil -1 3600))) |
| 36 | (should (equal (parse-time-string "Mon, 22 Feb 16 19:35:42 +0100") | 36 | (should (equal (parse-time-string "Mon, 22 Feb 16 19:35:42 +0100") |
| 37 | '(42 35 19 22 2 2016 1 nil 3600))) | 37 | '(42 35 19 22 2 2016 1 -1 3600))) |
| 38 | (should (equal (parse-time-string "Mon, 22 February 2016 19:35:42 +0100") | 38 | (should (equal (parse-time-string "Mon, 22 February 2016 19:35:42 +0100") |
| 39 | '(42 35 19 22 2 2016 1 nil 3600))) | 39 | '(42 35 19 22 2 2016 1 -1 3600))) |
| 40 | (should (equal (parse-time-string "Mon, 22 feb 2016 19:35:42 +0100") | 40 | (should (equal (parse-time-string "Mon, 22 feb 2016 19:35:42 +0100") |
| 41 | '(42 35 19 22 2 2016 1 nil 3600))) | 41 | '(42 35 19 22 2 2016 1 -1 3600))) |
| 42 | (should (equal (parse-time-string "Monday, 22 february 2016 19:35:42 +0100") | 42 | (should (equal (parse-time-string "Monday, 22 february 2016 19:35:42 +0100") |
| 43 | '(42 35 19 22 2 2016 1 nil 3600))) | 43 | '(42 35 19 22 2 2016 1 -1 3600))) |
| 44 | (should (equal (parse-time-string "Monday, 22 february 2016 19:35:42 PDT") | 44 | (should (equal (parse-time-string "Monday, 22 february 2016 19:35:42 PST") |
| 45 | '(42 35 19 22 2 2016 1 t -25200))) | 45 | '(42 35 19 22 2 2016 1 nil -28800))) |
| 46 | (should (equal (parse-time-string "Friday, 21 Sep 2018 13:47:58 PDT") | ||
| 47 | '(58 47 13 21 9 2018 5 t -25200))) | ||
| 46 | (should (equal (parse-iso8601-time-string "1998-09-12T12:21:54-0200") | 48 | (should (equal (parse-iso8601-time-string "1998-09-12T12:21:54-0200") |
| 47 | '(13818 33666))) | 49 | '(13818 33666))) |
| 48 | (should (equal (parse-iso8601-time-string "1998-09-12T12:21:54-0230") | 50 | (should (equal (parse-iso8601-time-string "1998-09-12T12:21:54-0230") |