GNU bug report logs -
#11281
DST has not effect on windows XP when system DST adjustment is disabled
Previous Next
Full log
Message #56 received at 11281 <at> debbugs.gnu.org (full text, mbox):
> Date: Sat, 24 May 2025 13:32:54 +0900
> From: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
> Cc: 11281 <at> debbugs.gnu.org,
> stefankangas <at> gmail.com
>
> > Note that this:
> >
> > (let ((time (encode-time '(0 0 12 20 5 2025 nil nil t))))
> > (setenv "TZ" "JST-9")
> > (decode-time time "est5edt"))
> >
> > yields the expected result.
>
> Yes, but it is true only if you had never called `(setenv "TZ" nil)'.
> Your example yields unexpected result if TZ environmental variable is
> not set at starting emacs (and it is Windows's default). Probably you
> set TZ environmental variable.
No, TZ is not set on my system. But my timezone does have DST rules,
so maybe that somehow affects the results.
> ;; After setting timezone without DST in the Windows Control Panel
> $ TZ= emacs -Q
>
> (let ((time (encode-time '(0 0 12 20 5 2025 nil nil t))))
> (setenv "TZ" "JST-9")
> (decode-time time "est5edt"))
>
> -> unexpected result
>
> So, following code would fail too.
>
> (let ((time (encode-time '(0 0 12 20 5 2025 nil nil t))))
> ;; After setting timezone without DST in the Windows Control Panel
> (setenv "TZ" nil)
> (setenv "TZ" "JST-9")
> (decode-time time "est5edt"))
>
> -> unexpected result
>
> > That is, as long as you tell MSVCRT that
> > your current timezone doesn't use DST, the conversion is correct.
>
> As I wrote above, this problem occurs after you once call `(setenv
> "TZ" nil)' under setting that system timezone is non-DST
> timezone. If you don't set TZ to nil, conversion would always
> succeed.
>
> $ TZ=est5edt emacs -Q
>
> (let ((time (encode-time '(0 0 12 20 5 2025 nil nil t))))
> (setenv "TZ" "JST-9t")
> (decode-time time "est5edt"))
>
> -> expected result
>
> (let ((time (encode-time '(0 0 12 20 5 2025 nil nil t))))
> (setenv "TZ" "pst8pdt")
> (decode-time time "est5edt"))
>
> -> expected result
Thanks. Volunteers are welcome to investigate how MSVCRT works and
why this sometimes causes incorrect results, because I've exhausted my
knowledge of this dark corner.
This bug report was last modified 19 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.