Module: wine Branch: master Commit: 0e44bda72a716a34106382f1b4ef5f376f28f267 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0e44bda72a716a34106382f1b4...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Tue Oct 18 15:34:05 2011 +0900
ntdll: Take into account timezone bias changes when detecting daylight saving rules.
---
dlls/ntdll/time.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/dlls/ntdll/time.c b/dlls/ntdll/time.c index 5a120f4..d233f23 100644 --- a/dlls/ntdll/time.c +++ b/dlls/ntdll/time.c @@ -728,18 +728,20 @@ static time_t find_dst_change(unsigned long min, unsigned long max, int *is_dst) static int init_tz_info(RTL_TIME_ZONE_INFORMATION *tzi) { static RTL_TIME_ZONE_INFORMATION cached_tzi; - static int current_year = -1; + static int current_year = -1, current_bias = 65535; struct tm *tm; time_t year_start, year_end, tmp, dlt = 0, std = 0; - int is_dst, current_is_dst; + int is_dst, current_is_dst, bias;
RtlEnterCriticalSection( &TIME_tz_section );
year_start = time(NULL); - tm = localtime(&year_start); + tm = gmtime(&year_start); + bias = (LONG)(mktime(tm) - year_start) / 60;
+ tm = localtime(&year_start); current_is_dst = tm->tm_isdst; - if (current_year == tm->tm_year) + if (current_year == tm->tm_year && current_bias == bias) { *tzi = cached_tzi; RtlLeaveCriticalSection( &TIME_tz_section ); @@ -748,8 +750,11 @@ static int init_tz_info(RTL_TIME_ZONE_INFORMATION *tzi)
memset(tzi, 0, sizeof(*tzi));
- TRACE("tz data will be valid through year %d\n", tm->tm_year + 1900); + TRACE("tz data will be valid through year %d, bias %d\n", tm->tm_year + 1900, bias); current_year = tm->tm_year; + current_bias = bias; + + tzi->Bias = bias;
tm->tm_isdst = 0; tm->tm_mday = 1; @@ -764,10 +769,6 @@ static int init_tz_info(RTL_TIME_ZONE_INFORMATION *tzi) year_end = mktime(tm); TRACE("year_end: %s", ctime(&year_end));
- tm = gmtime(&year_start); - tzi->Bias = (LONG)(mktime(tm) - year_start) / 60; - TRACE("bias: %d\n", tzi->Bias); - tmp = find_dst_change(year_start, year_end, &is_dst); if (is_dst) dlt = tmp;