From: Paul Gofman <pgofman@codeweavers.com> --- dlls/ntdll/unix/system.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 3559ba6a212..9194a8e2e3c 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -2676,6 +2676,7 @@ static int weekday_to_mday(int year, int day, int mon, int day_of_week) do { date.tm_mday++; + date.tm_isdst = -1; tmp = mktime(&date); } while (date.tm_wday != day_of_week || date.tm_mon != mon); @@ -2688,6 +2689,7 @@ static int weekday_to_mday(int year, int day, int mon, int day_of_week) struct tm *tm; date.tm_mday += 7; + date.tm_isdst = -1; tmp = mktime(&date); tm = localtime(&tmp); if (tm->tm_mon != mon) @@ -2947,6 +2949,7 @@ static void get_timezone_info( RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi ) char tz_name[16]; time_t year_start, year_end, tmp, dlt = 0, std = 0; int is_dst, bias; + BOOL inverted_dst; mutex_lock( &timezone_mutex ); @@ -2954,6 +2957,11 @@ static void get_timezone_info( RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi ) tm = gmtime(&year_start); bias = (LONG)(mktime(tm) - year_start) / 60; + tm = gmtime(&year_start); + tm->tm_isdst = 1; + inverted_dst = (mktime(tm) - year_start) / 60 - bias > 0; + if (inverted_dst) bias += 60; + tm = localtime(&year_start); if (current_year == tm->tm_year && current_bias == bias) { @@ -2968,18 +2976,19 @@ static void get_timezone_info( RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi ) tz_name[0] = '\0'; } - TRACE("tz data will be valid through year %d, bias %d\n", tm->tm_year + 1900, bias); + 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; tzi->Bias = bias; - tm->tm_isdst = 0; + tm->tm_isdst = inverted_dst; tm->tm_mday = 1; tm->tm_mon = tm->tm_hour = tm->tm_min = tm->tm_sec = tm->tm_wday = tm->tm_yday = 0; year_start = mktime(tm); TRACE("year_start: %s", ctime(&year_start)); + tm->tm_isdst = inverted_dst; tm->tm_mday = tm->tm_wday = tm->tm_yday = 0; tm->tm_mon = 12; tm->tm_hour = 23; @@ -2988,12 +2997,14 @@ static void get_timezone_info( RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi ) TRACE("year_end: %s", ctime(&year_end)); tmp = find_dst_change(year_start, year_end, &is_dst); + if (inverted_dst) is_dst = !is_dst; if (is_dst) dlt = tmp; else std = tmp; tmp = find_dst_change(tmp, year_end, &is_dst); + if (inverted_dst) is_dst = !is_dst; if (is_dst) dlt = tmp; else -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10134