[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be
From: |
Lars Ingebrigtsen |
Subject: |
bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess) |
Date: |
Thu, 26 May 2022 14:13:52 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Maxim Nikulin <m.a.nikulin@gmail.com> writes:
> Consider the following example:
>
> (format-time-string
> "%F %T %Z %z"
> (encode-time
> (make-decoded-time :year 2022 :month 3 :day 31
> :hour 23 :minute 30 :second 0
> :zone "Europe/Madrid"))
> "Europe/Madrid")
> "2022-04-01 00:30:00 CEST +0200"
>
> I believe that the result should be
> "2022-03-31 23:30:00 CEST +0200"
> It can be obtained if :dst -1 is explicitly added to the
> `make-decoded-time' arguments.
>
> Since `make-decoded-time' is defined using `cl-defun', I think, it is
> better to use -1 ("guess") default value for the :dst argument, not
> nil that explicitly says "no daylight saving time".
I think that makes some sense, but on the other hand, that's just a
simple helper function that does what it says -- "with only the keywords
given filled out". But perhaps -1 is less "filled out" than nil in this
case.
> There is `decoded-time-set-defaults', but it does not help
>
> (format-time-string
> "%F %T %Z %z"
> (encode-time
> (decoded-time-set-defaults
> (make-decoded-time :year 2022 :month 3 :day 31
> :hour 23 :minute 30)
> "Europe/Madrid"))
> "Europe/Madrid")
> "2022-04-01 01:30:00 CEST +0200"
>
> This case I have no idea how to fix the issue.
It's this code, I guess:
;; When we don't have a time zone, default to DEFAULT-ZONE without
;; DST if DEFAULT-ZONE if given, and to unknown DST otherwise.
(unless (decoded-time-zone time)
(if default-zone
(progn (setf (decoded-time-zone time) default-zone)
(setf (decoded-time-dst time) nil))
(setf (decoded-time-dst time) -1)))
I've added Paul to the CCs; perhaps he has some comments.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess), Maxim Nikulin, 2022/05/25
- bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess),
Lars Ingebrigtsen <=
- bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess), Paul Eggert, 2022/05/26
- bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess), Lars Ingebrigtsen, 2022/05/27
- bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess), Paul Eggert, 2022/05/27
- bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess), Lars Ingebrigtsen, 2022/05/28
- bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess), Maxim Nikulin, 2022/05/28
- bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess), Eli Zaretskii, 2022/05/28
- bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess), Paul Eggert, 2022/05/28
- bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess), Lars Ingebrigtsen, 2022/05/29
- bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess), Paul Eggert, 2022/05/29
- bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess), Maxim Nikulin, 2022/05/31