GNU bug report logs -
#11281
DST has not effect on windows XP when system DST adjustment is disabled
Previous Next
Full log
View this message in rfc822 format
> Cc: 11281 <at> debbugs.gnu.org, stefankangas <at> gmail.com
> Date: Fri, 23 May 2025 17:01:31 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
>
> > (let ((time (encode-time '(0 0 12 20 5 2025 nil nil t))))
> > (setenv "TZ" nil)
> > (decode-time time "est5edt"))
> >
> > Expected result: (0 0 8 20 5 2025 2 t -14400)
> > Actual result: (0 0 7 20 5 2025 2 t -18000)
> >
> > As far as I tested, the result depends on whether DST is enabled in
> > the Windows Control Panel at the time of evaluating `(setenv "TZ"
> > nil)'. In the case of Windows timezone which doesn't have DST, the
> > result is the same with unchecking DST option.
>
> I think this is because MSVCRT routines assume that every time zone
> has DST and changes to and from DST on certain fixed dates. IOW, they
> don't support timezones without DST and don't access the Windows
> settings for the actual timezone you are using. So the conversion to
> EST5EDT is performed as if your timezone also had DST and the DST were
> in effect at that date.
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. That is, as long as you tell MSVCRT that
your current timezone doesn't use DST, the conversion is correct.
It's only when TZ is unset that MSVCRT time functions decide there is
DST, regardless of the actual timezone defined for Windows.
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.