[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 accb3871668: Fix system time sampling on MS-Windows
From: |
Eli Zaretskii |
Subject: |
emacs-29 accb3871668: Fix system time sampling on MS-Windows |
Date: |
Fri, 24 Mar 2023 07:11:54 -0400 (EDT) |
branch: emacs-29
commit accb3871668201a1d7b9c54713b94b814c879271
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix system time sampling on MS-Windows
* src/timefns.c (emacs_localtime_rz) [WINDOWSNT]: Unconditionally
call tzset to make sure we pick up all the changes of time zone,
working around the MS CRT caching.
---
src/timefns.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/timefns.c b/src/timefns.c
index b3132e7bc34..87971cf4563 100644
--- a/src/timefns.c
+++ b/src/timefns.c
@@ -180,6 +180,15 @@ static timezone_t const utc_tz = 0;
static struct tm *
emacs_localtime_rz (timezone_t tz, time_t const *t, struct tm *tm)
{
+#ifdef WINDOWSNT
+ /* The Windows CRT functions are "optimized for speed", so they don't
+ check for timezone and DST changes if they were last called less
+ than 1 minute ago (see http://support.microsoft.com/kb/821231).
+ So all Emacs features that repeatedly call time functions (e.g.,
+ display-time) are in real danger of missing timezone and DST
+ changes. Calling tzset before each localtime call fixes that. */
+ tzset ();
+#endif
tm = localtime_rz (tz, t, tm);
if (!tm && errno == ENOMEM)
memory_full (SIZE_MAX);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 accb3871668: Fix system time sampling on MS-Windows,
Eli Zaretskii <=