From 0bec064454adac2bdff04a11bbdfaa79aa4ce052 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 21 Sep 2018 14:24:42 -0700 Subject: 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. --- src/editfns.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/editfns.c') 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 integer between 1 and 12. YEAR is an integer indicating the four-digit year. DOW is the day of week, an integer between 0 and 6, where 0 is Sunday. DST is t if daylight saving time is in effect, -otherwise nil. UTCOFF is an integer indicating the UTC offset in +nil if it is not in effect, and -1 if this information is +not available. UTCOFF is an integer indicating the UTC offset in seconds, i.e., the number of seconds east of Greenwich. (Note that Common Lisp has different meanings for DOW and UTCOFF.) @@ -2194,7 +2195,8 @@ usage: (decode-time &optional TIME ZONE) */) make_fixnum (local_tm.tm_mon + 1), make_fixnum (local_tm.tm_year + tm_year_base), make_fixnum (local_tm.tm_wday), - local_tm.tm_isdst ? Qt : Qnil, + (local_tm.tm_isdst < 0 ? make_fixnum (-1) + : local_tm.tm_isdst == 0 ? Qnil : Qt), (HAVE_TM_GMTOFF ? make_fixnum (tm_gmtoff (&local_tm)) : gmtime_r (&time_spec, &gmt_tm) -- cgit v1.2.1