all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess)
@ 2022-05-25 14:46 Maxim Nikulin
  2022-05-26 12:13 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Maxim Nikulin @ 2022-05-25 14:46 UTC (permalink / raw)
  To: 55635

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".

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.

An example in the `decoded-time-add' docstring
 >   (decoded-time-add (decode-time) (make-decoded-time :month 2))
adds even more confusion. If `make-decoded-time' is intended for 
intervals, not timestamps than it should not have DST and TZ values at 
all. Time interval may be added to timestamp, and time zone and daylight 
saving time flag is the property of particular timestamp while the same 
interval may be added to various timestamps and the actual result 
depends on the base timestamp.

Timestamp and interval are different types and should not be used 
interchangeably. nil/t/-1 interpretation difference for DST causes 
issues like (bug#54731), so it should be handled with care.





^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-06-14 15:57 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-25 14:46 bug#55635: `make-decoded-time' incorrectly sets DST to nil, it should be -1 (guess) Maxim Nikulin
2022-05-26 12:13 ` Lars Ingebrigtsen
2022-05-27  2:11   ` Paul Eggert
2022-05-27 10:40     ` Lars Ingebrigtsen
2022-05-27 19:26       ` Paul Eggert
2022-05-28 10:41         ` Lars Ingebrigtsen
2022-05-28 16:31           ` Maxim Nikulin
2022-05-28 16:53             ` Eli Zaretskii
2022-05-28 17:25               ` Paul Eggert
2022-05-29 13:10                 ` Lars Ingebrigtsen
2022-05-29 22:04                   ` Paul Eggert
2022-05-31 12:25                     ` Maxim Nikulin
2022-06-13 21:30                       ` Paul Eggert
2022-06-14 15:57                         ` Maxim Nikulin

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.