kernel32: Fix test case failures for time zones with absolute
transition dates
Dmitry Timoshkov
dmitry at codeweavers.com
Wed Aug 8 23:44:50 CDT 2007
Hello,
this patch fixes test case failures with new time zone detection code if
detected transition dates don't match the registry ones (for instance TZ=NZ).
Changelog:
kernel32: Fix test case failures for time zones with absolute
transition dates.
---
dlls/kernel32/tests/time.c | 3 ++-
dlls/kernel32/time.c | 14 ++++++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/tests/time.c b/dlls/kernel32/tests/time.c
index 83581c1..cf557ab 100644
--- a/dlls/kernel32/tests/time.c
+++ b/dlls/kernel32/tests/time.c
@@ -249,7 +249,8 @@ static void test_GetTimeZoneInformation(void)
trace("tz_id %u (%s)\n", tz_id,
tz_id == TIME_ZONE_ID_DAYLIGHT ? "TIME_ZONE_ID_DAYLIGHT" :
(tz_id == TIME_ZONE_ID_STANDARD ? "TIME_ZONE_ID_STANDARD" :
- "TIME_ZONE_ID_INVALID"));
+ (tz_id == TIME_ZONE_ID_UNKNOWN ? "TIME_ZONE_ID_UNKNOWN" :
+ "TIME_ZONE_ID_INVALID")));
trace("bias %d\n", tzinfo.Bias);
trace("standard (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %d\n",
diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c
index 90af803..9aa9c69 100644
--- a/dlls/kernel32/time.c
+++ b/dlls/kernel32/time.c
@@ -101,7 +101,10 @@ static int TIME_DayLightCompareDate( const SYSTEMTIME *date,
if (date->wMonth > compareDate->wMonth)
return 1; /* We are in a month after the date limit. */
- if (compareDate->wDayOfWeek <= 6)
+ /* if year is 0 then date is in day-of-week format, otherwise
+ * it's absolute date.
+ */
+ if (compareDate->wYear == 0)
{
WORD First;
/* compareDate->wDay is interpreted as number of the week in the month
@@ -160,11 +163,14 @@ static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
if (pTZinfo->DaylightDate.wMonth != 0)
{
- if (pTZinfo->StandardDate.wMonth == 0 ||
- pTZinfo->StandardDate.wDay<1 ||
+ /* if year is 0 then date is in day-of-week format, otherwise
+ * it's absolute date.
+ */
+ if (pTZinfo->StandardDate.wYear == 0 &&
+ (pTZinfo->StandardDate.wDay<1 ||
pTZinfo->StandardDate.wDay>5 ||
pTZinfo->DaylightDate.wDay<1 ||
- pTZinfo->DaylightDate.wDay>5)
+ pTZinfo->DaylightDate.wDay>5))
{
SetLastError(ERROR_INVALID_PARAMETER);
return TIME_ZONE_ID_INVALID;
--
1.5.2.3
More information about the wine-patches
mailing list