From: Zhou Qiankang <wszqkzqk@qq.com> inverted DST detection (two mktime() calls) out of the cache hit fast path in get_timezone_info(). Keep the cache key based on the cheap raw bias value and only compute inverted_dst/adjusted_bias on cache miss. Preserve the inverse DST correctness fix by still applying adjusted_bias to tzi->Bias in the slow path. This restores fast-path behavior for frequent GetTimeZoneInformation callers without regressing inverse DST handling. Fixes regression: bfae6eb8b4f6 ("ntdll: Fix get_timezone_info() for timezones defined with inverse DST on Unix.") Fixes: https://bugs.winehq.org/show_bug.cgi?id=59514 Signed-off-by: Zhou Qiankang <wszqkzqk@qq.com> --- dlls/ntdll/unix/system.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 22f8b496220..aa66ec2654c 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -3012,12 +3012,6 @@ static void get_timezone_info( RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi ) bias = (LONG)(mktime(tm) - year_start) / 60; tm = localtime(&year_start); - tm1 = tm2 = *tm; - tm1.tm_isdst = 0; - tm2.tm_isdst = 1; - inverted_dst = mktime(&tm1) < mktime(&tm2); - if (inverted_dst) bias += 60; - if (current_year == tm->tm_year && current_bias == bias) { *tzi = cached_tzi; @@ -3025,10 +3019,16 @@ static void get_timezone_info( RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi ) return; } - memset(tzi, 0, sizeof(*tzi)); - TRACE("tz data will be valid through year %d, bias %d, inverted_dst %d\n", tm->tm_year + 1900, bias, inverted_dst); current_year = tm->tm_year; current_bias = bias; + tm1 = tm2 = *tm; + tm1.tm_isdst = 0; + tm2.tm_isdst = 1; + inverted_dst = mktime(&tm1) < mktime(&tm2); + if (inverted_dst) bias += 60; + + memset(tzi, 0, sizeof(*tzi)); + TRACE("tz data will be valid through year %d, bias %d, inverted_dst %d\n", tm->tm_year + 1900, bias, inverted_dst); tzi->Bias = bias; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10348