ntdll: Do not leave not initialized cached timezone information if a timezone doesn't have daylight saving rules.
This commit is contained in:
parent
dba0977092
commit
a76ef05c90
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "wine/test.h"
|
||||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
|
||||
static BOOL (WINAPI *pTzSpecificLocalTimeToSystemTime)(LPTIME_ZONE_INFORMATION, LPSYSTEMTIME, LPSYSTEMTIME);
|
||||
static BOOL (WINAPI *pSystemTimeToTzSpecificLocalTime)(LPTIME_ZONE_INFORMATION, LPSYSTEMTIME, LPSYSTEMTIME);
|
||||
|
@ -221,6 +222,7 @@ static LONG get_tz_bias(const TIME_ZONE_INFORMATION *tzinfo, DWORD tz_id)
|
|||
|
||||
static void test_GetTimeZoneInformation(void)
|
||||
{
|
||||
char std_name[32], dlt_name[32];
|
||||
TIME_ZONE_INFORMATION tzinfo, tzinfo1;
|
||||
BOOL res;
|
||||
DWORD tz_id;
|
||||
|
@ -252,7 +254,9 @@ static void test_GetTimeZoneInformation(void)
|
|||
(tz_id == TIME_ZONE_ID_UNKNOWN ? "TIME_ZONE_ID_UNKNOWN" :
|
||||
"TIME_ZONE_ID_INVALID")));
|
||||
|
||||
trace("bias %d\n", tzinfo.Bias);
|
||||
WideCharToMultiByte(CP_ACP, 0, tzinfo.StandardName, -1, std_name, sizeof(std_name), NULL, NULL);
|
||||
WideCharToMultiByte(CP_ACP, 0, tzinfo.DaylightName, -1, dlt_name, sizeof(dlt_name), NULL, NULL);
|
||||
trace("bias %d, %s - %s\n", tzinfo.Bias, std_name, dlt_name);
|
||||
trace("standard (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %d\n",
|
||||
tzinfo.StandardDate.wDay, tzinfo.StandardDate.wMonth,
|
||||
tzinfo.StandardDate.wYear, tzinfo.StandardDate.wDayOfWeek,
|
||||
|
|
|
@ -787,54 +787,52 @@ static int init_tz_info(RTL_TIME_ZONE_INFORMATION *tzi)
|
|||
TRACE("dlt: %s", ctime(&dlt));
|
||||
|
||||
if (dlt == std || !dlt || !std)
|
||||
{
|
||||
RtlLeaveCriticalSection( &TIME_tz_section );
|
||||
TRACE("there is no daylight saving rules in this time zone\n");
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
tmp = dlt - tzi->Bias * 60;
|
||||
tm = gmtime(&tmp);
|
||||
TRACE("dlt gmtime: %s", asctime(tm));
|
||||
|
||||
tzi->DaylightBias = -60;
|
||||
tzi->DaylightDate.wYear = tm->tm_year + 1900;
|
||||
tzi->DaylightDate.wMonth = tm->tm_mon + 1;
|
||||
tzi->DaylightDate.wDayOfWeek = tm->tm_wday;
|
||||
tzi->DaylightDate.wDay = tm->tm_mday;
|
||||
tzi->DaylightDate.wHour = tm->tm_hour;
|
||||
tzi->DaylightDate.wMinute = tm->tm_min;
|
||||
tzi->DaylightDate.wSecond = tm->tm_sec;
|
||||
tzi->DaylightDate.wMilliseconds = 0;
|
||||
|
||||
TRACE("daylight (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %d\n",
|
||||
tzi->DaylightDate.wDay, tzi->DaylightDate.wMonth,
|
||||
tzi->DaylightDate.wYear, tzi->DaylightDate.wDayOfWeek,
|
||||
tzi->DaylightDate.wHour, tzi->DaylightDate.wMinute,
|
||||
tzi->DaylightDate.wSecond, tzi->DaylightDate.wMilliseconds,
|
||||
tzi->DaylightBias);
|
||||
|
||||
tmp = std - tzi->Bias * 60 - tzi->DaylightBias * 60;
|
||||
tm = gmtime(&tmp);
|
||||
TRACE("std gmtime: %s", asctime(tm));
|
||||
|
||||
tzi->StandardBias = 0;
|
||||
tzi->StandardDate.wYear = tm->tm_year + 1900;
|
||||
tzi->StandardDate.wMonth = tm->tm_mon + 1;
|
||||
tzi->StandardDate.wDayOfWeek = tm->tm_wday;
|
||||
tzi->StandardDate.wDay = tm->tm_mday;
|
||||
tzi->StandardDate.wHour = tm->tm_hour;
|
||||
tzi->StandardDate.wMinute = tm->tm_min;
|
||||
tzi->StandardDate.wSecond = tm->tm_sec;
|
||||
tzi->StandardDate.wMilliseconds = 0;
|
||||
|
||||
TRACE("standard (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %d\n",
|
||||
tzi->StandardDate.wDay, tzi->StandardDate.wMonth,
|
||||
tzi->StandardDate.wYear, tzi->StandardDate.wDayOfWeek,
|
||||
tzi->StandardDate.wHour, tzi->StandardDate.wMinute,
|
||||
tzi->StandardDate.wSecond, tzi->StandardDate.wMilliseconds,
|
||||
tzi->StandardBias);
|
||||
}
|
||||
|
||||
tmp = dlt - tzi->Bias * 60;
|
||||
tm = gmtime(&tmp);
|
||||
TRACE("dlt gmtime: %s", asctime(tm));
|
||||
|
||||
tzi->DaylightBias = -60;
|
||||
tzi->DaylightDate.wYear = tm->tm_year + 1900;
|
||||
tzi->DaylightDate.wMonth = tm->tm_mon + 1;
|
||||
tzi->DaylightDate.wDayOfWeek = tm->tm_wday;
|
||||
tzi->DaylightDate.wDay = tm->tm_mday;
|
||||
tzi->DaylightDate.wHour = tm->tm_hour;
|
||||
tzi->DaylightDate.wMinute = tm->tm_min;
|
||||
tzi->DaylightDate.wSecond = tm->tm_sec;
|
||||
tzi->DaylightDate.wMilliseconds = 0;
|
||||
|
||||
TRACE("daylight (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %d\n",
|
||||
tzi->DaylightDate.wDay, tzi->DaylightDate.wMonth,
|
||||
tzi->DaylightDate.wYear, tzi->DaylightDate.wDayOfWeek,
|
||||
tzi->DaylightDate.wHour, tzi->DaylightDate.wMinute,
|
||||
tzi->DaylightDate.wSecond, tzi->DaylightDate.wMilliseconds,
|
||||
tzi->DaylightBias);
|
||||
|
||||
tmp = std - tzi->Bias * 60 - tzi->DaylightBias * 60;
|
||||
tm = gmtime(&tmp);
|
||||
TRACE("std gmtime: %s", asctime(tm));
|
||||
|
||||
tzi->StandardBias = 0;
|
||||
tzi->StandardDate.wYear = tm->tm_year + 1900;
|
||||
tzi->StandardDate.wMonth = tm->tm_mon + 1;
|
||||
tzi->StandardDate.wDayOfWeek = tm->tm_wday;
|
||||
tzi->StandardDate.wDay = tm->tm_mday;
|
||||
tzi->StandardDate.wHour = tm->tm_hour;
|
||||
tzi->StandardDate.wMinute = tm->tm_min;
|
||||
tzi->StandardDate.wSecond = tm->tm_sec;
|
||||
tzi->StandardDate.wMilliseconds = 0;
|
||||
|
||||
TRACE("standard (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %d\n",
|
||||
tzi->StandardDate.wDay, tzi->StandardDate.wMonth,
|
||||
tzi->StandardDate.wYear, tzi->StandardDate.wDayOfWeek,
|
||||
tzi->StandardDate.wHour, tzi->StandardDate.wMinute,
|
||||
tzi->StandardDate.wSecond, tzi->StandardDate.wMilliseconds,
|
||||
tzi->StandardBias);
|
||||
|
||||
find_reg_tz_info(tzi);
|
||||
cached_tzi = *tzi;
|
||||
|
||||
|
|
Loading…
Reference in New Issue