2 * Unit test suite for time functions
4 * Copyright 2004 Uwe Bonnes
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/test.h"
26 #define SECSPERDAY 86400
27 /* 1601 to 1970 is 369 years plus 89 leap days */
28 #define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)SECSPERDAY)
29 #define TICKSPERSEC 10000000
30 #define TICKSPERMSEC 10000
31 #define TICKS_1601_TO_1970 (SECS_1601_TO_1970 * TICKSPERSEC)
34 #define NEWYEAR_1980_HI 0x01a8e79f
35 #define NEWYEAR_1980_LO 0xe1d58000
37 #define MAYDAY_2002_HI 0x01c1f107
38 #define MAYDAY_2002_LO 0xb82b6000
40 #define ATIME_HI 0x1c2349b
41 #define ATIME_LOW 0x580716b0
43 #define LOCAL_ATIME_HI 0x01c23471
44 #define LOCAL_ATIME_LOW 0x6f310eb0
46 #define DOS_DATE(y,m,d) ( (((y)-1980)<<9) | ((m)<<5) | (d) )
47 #define DOS_TIME(h,m,s) ( ((h)<<11) | ((m)<<5) | ((s)>>1) )
50 #define SETUP_1980(st) \
57 (st).wMilliseconds = 0;
59 #define SETUP_2002(st) \
66 (st).wMilliseconds = 0;
68 #define SETUP_ATIME(st) \
75 (st).wMilliseconds = 123;
79 static void test_conversions(void)
84 memset(&ft
,0,sizeof ft
);
87 ok (SystemTimeToFileTime(&st
,&ft
), "Conversion Failed ATIME\n");
88 ok( (!((ft
.dwHighDateTime
!= ATIME_HI
) || (ft
.dwLowDateTime
!=ATIME_LOW
))),
89 "Wrong time for ATIME: %08x %08x (correct %08x %08x)\n",
90 ft
.dwLowDateTime
, ft
.dwHighDateTime
, ATIME_LOW
, ATIME_HI
);
94 ok (SystemTimeToFileTime(&st
, &ft
), "Conversion failed 2002\n");
96 ok( (!((ft
.dwHighDateTime
!= MAYDAY_2002_HI
) ||
97 (ft
.dwLowDateTime
!=MAYDAY_2002_LO
))),
98 "Wrong time for 2002 %08x %08x (correct %08x %08x)\n", ft
.dwLowDateTime
,
99 ft
.dwHighDateTime
, MAYDAY_2002_LO
, MAYDAY_2002_HI
);
103 ok((SystemTimeToFileTime(&st
, &ft
)), "Conversion failed 1980\n");
105 ok( (!((ft
.dwHighDateTime
!=NEWYEAR_1980_HI
) ||
106 (ft
.dwLowDateTime
!=NEWYEAR_1980_LO
))) ,
107 "Wrong time for 1980 %08x %08x (correct %08x %08x)\n", ft
.dwLowDateTime
,
108 ft
.dwHighDateTime
, NEWYEAR_1980_LO
,NEWYEAR_1980_HI
);
110 ok(DosDateTimeToFileTime(DOS_DATE(1980,1,1),DOS_TIME(0,0,0),&ft
),
111 "DosDateTimeToFileTime() failed\n");
113 ok( (!((ft
.dwHighDateTime
!=NEWYEAR_1980_HI
) ||
114 (ft
.dwLowDateTime
!=NEWYEAR_1980_LO
))),
115 "Wrong time DosDateTimeToFileTime %08x %08x (correct %08x %08x)\n",
116 ft
.dwHighDateTime
, ft
.dwLowDateTime
, NEWYEAR_1980_HI
, NEWYEAR_1980_LO
);
120 static void test_invalid_arg(void)
126 /* Invalid argument checks */
128 memset(&ft
,0,sizeof ft
);
129 ok( DosDateTimeToFileTime(DOS_DATE(1980,1,1),DOS_TIME(0,0,0),&ft
), /* this is 1 Jan 1980 00:00:00 */
130 "DosDateTimeToFileTime() failed\n");
132 ok( (ft
.dwHighDateTime
==NEWYEAR_1980_HI
) && (ft
.dwLowDateTime
==NEWYEAR_1980_LO
),
133 "filetime for 1/1/80 00:00:00 was %08x %08x\n", ft
.dwHighDateTime
, ft
.dwLowDateTime
);
135 /* now check SystemTimeToFileTime */
136 memset(&ft
,0,sizeof ft
);
139 /* try with a bad month */
143 ok( !SystemTimeToFileTime(&st
, &ft
), "bad month\n");
145 /* with a bad hour */
149 ok( !SystemTimeToFileTime(&st
, &ft
), "bad hour\n");
151 /* with a bad minute */
155 ok( !SystemTimeToFileTime(&st
, &ft
), "bad minute\n");
160 const char *windows_name
;
163 static tztestinfo timezones
[]=
165 {"Kwajalein", "Dateline Standard Time"},
166 {"Pacific/Samoa", "Samoa Standard Time"},
167 {"US/Hawaii", "Hawaiian Standard Time"},
168 {"US/Alaska", "Alaskan Standard Time"},
169 {"America/Tijuana", "Pacific Standard Time"},
170 {"America/Chihuahua", "Mexico Standard Time 2"},
171 {"US/Mountain", "Mountain Standard Time"},
172 {"US/Arizona", "US Mountain Standard Time"},
173 {"US/Central", "Central Standard Time"},
174 {"America/Mexico_City", "Mexico Standard Time"},
175 {"Canada/Saskatchewan", "Canada Central Standard Time"},
176 {"America/El_Salvador", "Central America Standard Time"},
177 {"US/Eastern", "Eastern Standard Time"},
178 {"US/Indiana-Starke", "US Eastern Standard Time"},
179 {"America/Bogota", "SA Pacific Standard Time"},
180 {"America/Lima", "SA Pacific Standard Time"},
181 {"Canada/Atlantic", "Atlantic Standard Time"},
182 {"America/Caracas", "SA Western Standard Time"},
183 {"America/Santiago", "Pacific SA Standard Time"},
184 {"Canada/Newfoundland", "Newfoundland Standard Time"},
185 {"America/Buenos_Aires","SA Eastern Standard Time"},
186 {"Brazil/East", "E. South America Standard Time"},
187 /* Greenland Standard Time */
188 /* Mid-Atlantic Standard Time */
189 {"Atlantic/Azores", "Azores Standard Time"},
190 {"Atlantic/Cape_Verde", "Cape Verde Standard Time"},
191 {"Africa/Casablanca", "Greenwich Standard Time"},
192 {"Europe/London", "GMT Standard Time"},
193 {"Europe/Paris", "Romance Standard Time"},
194 /* W. Central Africa Standard Time */
195 {"Europe/Belgrade", "Central Europe Standard Time"},
196 {"Africa/Cairo", "Egypt Standard Time"},
197 {"Africa/Johannesburg", "South Africa Standard Time"},
198 {"Israel", "Israel Standard Time"},
199 {"Europe/Bucharest", "E. Europe Standard Time"},
200 {"Europe/Helsinki", "FLE Standard Time"},
201 {"Europe/Athens", "GTB Standard Time"},
202 {"Asia/Kuwait", "Arab Standard Time"},
203 {"Africa/Nairobi", "E. Africa Standard Time"},
204 {"Asia/Baghdad", "Arabic Standard Time"},
205 {"Europe/Moscow", "Russian Standard Time"},
206 {"Asia/Tehran", "Iran Standard Time"},
207 {"Asia/Muscat", "Arabian Standard Time"},
208 {"Asia/Baku", "Caucasus Standard Time"},
209 {"Asia/Kabul", "Afghanistan Standard Time"},
210 {"Asia/Karachi", "West Asia Standard Time"},
211 /* Ekaterinburg Standard Time */
212 {"Asia/Calcutta", "India Standard Time"},
213 /* Nepal Standard Time */
214 {"Asia/Dhaka", "Central Asia Standard Time"},
215 /* Sri Lanka Standard Time */
216 {"Asia/Novosibirsk", "N. Central Asia Standard Time"},
217 {"Asia/Rangoon", "Myanmar Standard Time"},
218 {"Asia/Bangkok", "SE Asia Standard Time"},
219 {"Asia/Krasnoyarsk", "North Asia Standard Time"},
220 {"Asia/Shanghai", "China Standard Time"},
221 {"Australia/Perth", "W. Australia Standard Time"},
222 {"Asia/Singapore", "Singapore Standard Time"},
223 {"Asia/Taipei", "Taipei Standard Time"},
224 {"Asia/Irkutsk", "North Asia East Standard Time"},
225 {"Japan", "Tokyo Standard Time"},
226 {"Asia/Seoul", "Korea Standard Time"},
227 {"Asia/Yakutsk", "Yakutsk Standard Time"},
228 {"Australia/Darwin", "AUS Central Standard Time"},
229 {"Australia/Adelaide", "Cen. Australia Standard Time"},
230 {"Australia/Brisbane", "E. Australia Standard Time"},
231 {"Pacific/Guam", "West Pacific Standard Time"},
232 {"Asia/Vladivostok", "Vladivostok Standard Time"},
233 {"Asia/Magadan", "Central Pacific Standard Time"},
234 {"Pacific/Fiji", "Fiji Standard Time"},
235 {"Pacific/Auckland", "New Zealand Standard Time"},
236 {"Pacific/Tongatapu", "Tonga Standard Time"}
239 static tztestinfo todo_timezones
[]=
241 {"Europe/Berlin", "W. Europe Standard Time"},
242 {"Europe/Budapest", "Central European Standard Time"},
243 {"Australia/Melbourne", "AUS Eastern Standard Time"},
244 {"Australia/Hobart", "Tasmania Standard Time"},
247 static void test_GetTimeZoneInformation(void)
249 TIME_ZONE_INFORMATION tzinfo
, tzinfo1
;
250 DWORD res
= GetTimeZoneInformation(&tzinfo
);
252 const char *originaltz
;
255 ok(res
!= TIME_ZONE_ID_INVALID
, "GetTimeZoneInformation failed\n");
256 ok(SetEnvironmentVariableA("TZ","GMT0") != 0,
257 "SetEnvironmentVariableA failed\n");
258 res
= GetTimeZoneInformation(&tzinfo1
);
259 ok(res
!= TIME_ZONE_ID_INVALID
, "GetTimeZoneInformation failed\n");
261 ok(((tzinfo
.Bias
== tzinfo1
.Bias
) &&
262 (tzinfo
.StandardBias
== tzinfo1
.StandardBias
) &&
263 (tzinfo
.DaylightBias
== tzinfo1
.DaylightBias
)),
264 "Bias influenced by TZ variable\n");
265 ok(SetEnvironmentVariableA("TZ",NULL
) != 0,
266 "SetEnvironmentVariableA failed\n");
268 /* Check handling of timezones around the world*/
269 originaltz
= getenv("TZ");
270 for (i
= 0; i
< sizeof(timezones
)/sizeof(tztestinfo
); i
++)
272 setenv("TZ",timezones
[i
].env
,1);
273 res
= GetTimeZoneInformation(&tzinfo1
);
274 WideCharToMultiByte(CP_ACP
,0,tzinfo1
.StandardName
,-1,tzname
,32,0,0);
275 ok(strcmp(tzname
,timezones
[i
].windows_name
)==0,"%s failed, result %s\n"
276 ,timezones
[i
].windows_name
,tzname
);
279 for (i
= 0; i
< sizeof(todo_timezones
)/sizeof(tztestinfo
); i
++)
281 setenv("TZ",todo_timezones
[i
].env
,1);
282 res
= GetTimeZoneInformation(&tzinfo1
);
283 WideCharToMultiByte(CP_ACP
,0,tzinfo1
.StandardName
,-1,tzname
,32,0,0);
285 ok(strcmp(tzname
,todo_timezones
[i
].windows_name
)==0,
286 "%s failed, result %s\n" ,todo_timezones
[i
].windows_name
,tzname
);
292 setenv("TZ",originaltz
,1);
298 static void test_FileTimeToSystemTime(void)
302 ULONGLONG time
= (ULONGLONG
)TICKSPERSEC
+ TICKS_1601_TO_1970
;
305 ft
.dwHighDateTime
= 0;
306 ft
.dwLowDateTime
= 0;
307 ret
= FileTimeToSystemTime(&ft
, &st
);
309 "FileTimeToSystemTime() failed with Error %d\n",GetLastError());
310 ok(((st
.wYear
== 1601) && (st
.wMonth
== 1) && (st
.wDay
== 1) &&
311 (st
.wHour
== 0) && (st
.wMinute
== 0) && (st
.wSecond
== 0) &&
312 (st
.wMilliseconds
== 0)),
313 "Got Year %4d Month %2d Day %2d\n", st
.wYear
, st
.wMonth
, st
.wDay
);
315 ft
.dwHighDateTime
= (UINT
)(time
>> 32);
316 ft
.dwLowDateTime
= (UINT
)time
;
317 ret
= FileTimeToSystemTime(&ft
, &st
);
319 "FileTimeToSystemTime() failed with Error %d\n",GetLastError());
320 ok(((st
.wYear
== 1970) && (st
.wMonth
== 1) && (st
.wDay
== 1) &&
321 (st
.wHour
== 0) && (st
.wMinute
== 0) && (st
.wSecond
== 1) &&
322 (st
.wMilliseconds
== 0)),
323 "Got Year %4d Month %2d Day %2d Hour %2d Min %2d Sec %2d mSec %3d\n",
324 st
.wYear
, st
.wMonth
, st
.wDay
, st
.wHour
, st
.wMinute
, st
.wSecond
,
328 static void test_FileTimeToLocalFileTime(void)
332 TIME_ZONE_INFORMATION tzinfo
;
333 DWORD res
= GetTimeZoneInformation(&tzinfo
);
334 ULONGLONG time
= (ULONGLONG
)TICKSPERSEC
+ TICKS_1601_TO_1970
+
335 (LONGLONG
)(tzinfo
.Bias
+
336 ( res
== TIME_ZONE_ID_STANDARD
? tzinfo
.StandardBias
:
337 ( res
== TIME_ZONE_ID_DAYLIGHT
? tzinfo
.DaylightBias
: 0 ))) *
338 SECSPERMIN
*TICKSPERSEC
;
341 ok( res
!= TIME_ZONE_ID_INVALID
, "GetTimeZoneInformation failed\n");
342 ft
.dwHighDateTime
= (UINT
)(time
>> 32);
343 ft
.dwLowDateTime
= (UINT
)time
;
344 ret
= FileTimeToLocalFileTime(&ft
, &lft
);
346 "FileTimeToLocalFileTime() failed with Error %d\n",GetLastError());
347 FileTimeToSystemTime(&lft
, &st
);
348 ok(((st
.wYear
== 1970) && (st
.wMonth
== 1) && (st
.wDay
== 1) &&
349 (st
.wHour
== 0) && (st
.wMinute
== 0) && (st
.wSecond
== 1) &&
350 (st
.wMilliseconds
== 0)),
351 "Got Year %4d Month %2d Day %2d Hour %2d Min %2d Sec %2d mSec %3d\n",
352 st
.wYear
, st
.wMonth
, st
.wDay
, st
.wHour
, st
.wMinute
, st
.wSecond
,
355 ok(SetEnvironmentVariableA("TZ","GMT") != 0,
356 "SetEnvironmentVariableA failed\n");
357 ok(res
!= TIME_ZONE_ID_INVALID
, "GetTimeZoneInformation failed\n");
358 ret
= FileTimeToLocalFileTime(&ft
, &lft
);
360 "FileTimeToLocalFileTime() failed with Error %d\n",GetLastError());
361 FileTimeToSystemTime(&lft
, &st
);
362 ok(((st
.wYear
== 1970) && (st
.wMonth
== 1) && (st
.wDay
== 1) &&
363 (st
.wHour
== 0) && (st
.wMinute
== 0) && (st
.wSecond
== 1) &&
364 (st
.wMilliseconds
== 0)),
365 "Got Year %4d Month %2d Day %2d Hour %2d Min %2d Sec %2d mSec %3d\n",
366 st
.wYear
, st
.wMonth
, st
.wDay
, st
.wHour
, st
.wMinute
, st
.wSecond
,
368 ok(SetEnvironmentVariableA("TZ",NULL
) != 0,
369 "SetEnvironmentVariableA failed\n");
373 /* test TzSpecificLocalTimeToSystemTime and SystemTimeToTzSpecificLocalTime
374 * these are in winXP and later */
375 typedef HANDLE (WINAPI
*fnTzSpecificLocalTimeToSystemTime
)( LPTIME_ZONE_INFORMATION
, LPSYSTEMTIME
, LPSYSTEMTIME
);
376 typedef HANDLE (WINAPI
*fnSystemTimeToTzSpecificLocalTime
)( LPTIME_ZONE_INFORMATION
, LPSYSTEMTIME
, LPSYSTEMTIME
);
379 int nr
; /* test case number for easier lookup */
380 TIME_ZONE_INFORMATION
*ptz
; /* ptr to timezone */
381 SYSTEMTIME slt
; /* system/local time to convert */
382 WORD ehour
; /* expected hour */
385 static void test_TzSpecificLocalTimeToSystemTime(void)
387 HMODULE hKernel
= GetModuleHandle("kernel32");
388 fnTzSpecificLocalTimeToSystemTime pTzSpecificLocalTimeToSystemTime
;
389 fnSystemTimeToTzSpecificLocalTime pSystemTimeToTzSpecificLocalTime
= NULL
;
390 TIME_ZONE_INFORMATION tzE
, tzW
, tzS
;
393 pTzSpecificLocalTimeToSystemTime
= (fnTzSpecificLocalTimeToSystemTime
) GetProcAddress( hKernel
, "TzSpecificLocalTimeToSystemTime");
394 if(pTzSpecificLocalTimeToSystemTime
)
395 pSystemTimeToTzSpecificLocalTime
= (fnTzSpecificLocalTimeToSystemTime
) GetProcAddress( hKernel
, "SystemTimeToTzSpecificLocalTime");
396 if( !pSystemTimeToTzSpecificLocalTime
)
398 ZeroMemory( &tzE
, sizeof(tzE
));
399 ZeroMemory( &tzW
, sizeof(tzW
));
400 ZeroMemory( &tzS
, sizeof(tzS
));
401 /* timezone Eastern hemisphere */
404 tzE
.DaylightBias
=-60;
405 tzE
.StandardDate
.wMonth
=10;
406 tzE
.StandardDate
.wDayOfWeek
=0; /*sunday */
407 tzE
.StandardDate
.wDay
=5; /* last (sunday) of the month */
408 tzE
.StandardDate
.wHour
=3;
409 tzE
.DaylightDate
.wMonth
=3;
410 tzE
.DaylightDate
.wDay
=5;
411 tzE
.DaylightDate
.wHour
=2;
412 /* timezone Western hemisphere */
415 tzW
.DaylightBias
=-60;
416 tzW
.StandardDate
.wMonth
=10;
417 tzW
.StandardDate
.wDayOfWeek
=0; /*sunday */
418 tzW
.StandardDate
.wDay
=4; /* 4th (sunday) of the month */
419 tzW
.StandardDate
.wHour
=2;
420 tzW
.DaylightDate
.wMonth
=4;
421 tzW
.DaylightDate
.wDay
=1;
422 tzW
.DaylightDate
.wHour
=2;
423 /* timezone Eastern hemisphere */
426 tzS
.DaylightBias
=-60;
427 tzS
.StandardDate
.wMonth
=4;
428 tzS
.StandardDate
.wDayOfWeek
=0; /*sunday */
429 tzS
.StandardDate
.wDay
=1; /* 1st (sunday) of the month */
430 tzS
.StandardDate
.wHour
=2;
431 tzS
.DaylightDate
.wMonth
=10;
432 tzS
.DaylightDate
.wDay
=4;
433 tzS
.DaylightDate
.wHour
=2;
435 /* TzSpecificLocalTimeToSystemTime */
436 { TZLT2ST_case cases
[] = {
437 /* standard->daylight transition */
438 { 1, &tzE
, {2004,3,-1,28,1,0,0,0}, 15 },
439 { 2, &tzE
, {2004,3,-1,28,1,59,59,999}, 15},
440 { 3, &tzE
, {2004,3,-1,28,2,0,0,0}, 15},
441 /* daylight->standard transition */
442 { 4, &tzE
, {2004,10,-1,31,2,0,0,0} , 15 },
443 { 5, &tzE
, {2004,10,-1,31,2,59,59,999}, 15 },
444 { 6, &tzE
, {2004,10,-1,31,3,0,0,0}, 17 },
445 /* West and with fixed weekday of the month */
446 { 7, &tzW
, {2004,4,-1,4,1,0,0,0}, 5},
447 { 8, &tzW
, {2004,4,-1,4,1,59,59,999}, 5},
448 { 9, &tzW
, {2004,4,-1,4,2,0,0,0}, 5},
449 { 10, &tzW
, {2004,10,-1,24,1,0,0,0}, 4},
450 { 11, &tzW
, {2004,10,-1,24,1,59,59,999}, 4},
451 { 12, &tzW
, {2004,10,-1,24,2,0,0,0 }, 6},
453 { 13, &tzS
, {2004,4,-1,4,1,0,0,0}, 4},
454 { 14, &tzS
, {2004,4,-1,4,1,59,59,999}, 4},
455 { 15, &tzS
, {2004,4,-1,4,2,0,0,0}, 6},
456 { 16, &tzS
, {2004,10,-1,24,1,0,0,0}, 5},
457 { 17, &tzS
, {2004,10,-1,24,1,59,59,999}, 5},
458 { 18, &tzS
, {2004,10,-1,24,2,0,0,0}, 5},
461 /* days of transitions to put into the cases array */
464 {28,31,4,24,4,24} /* 1999 */
465 , {26,29,2,22,2,22} /* 2000 */
466 , {25,28,1,28,1,28} /* 2001 */
467 , {31,27,7,27,7,27} /* 2002 */
468 , {30,26,6,26,6,26} /* 2003 */
469 , {28,31,4,24,4,24} /* 2004 */
470 , {27,30,3,23,3,23} /* 2005 */
471 , {26,29,2,22,2,22} /* 2006 */
472 , {25,28,1,28,1,28} /* 2007 */
473 , {30,26,6,26,6,26} /* 2008 */
474 , {29,25,5,25,5,25} /* 2009 */
475 , {28,31,4,24,4,24} /* 2010 */
476 , {27,30,3,23,3,23} /* 2011 */
477 , {25,28,1,28,1,28} /* 2012 */
478 , {31,27,7,27,7,27} /* 2013 */
479 , {30,26,6,26,6,26} /* 2014 */
480 , {29,25,5,25,5,25} /* 2015 */
481 , {27,30,3,23,3,23} /* 2016 */
482 , {26,29,2,22,2,22} /* 2017 */
483 , {25,28,1,28,1,28} /* 2018 */
484 , {31,27,7,27,7,27} /* 2019 */
487 for( j
=0 , year
= 1999; yeardays
[j
][0] ; j
++, year
++) {
488 for (i
=0; cases
[i
].nr
; i
++) {
489 if(i
) cases
[i
].nr
+= 18;
490 cases
[i
].slt
.wYear
= year
;
491 cases
[i
].slt
.wDay
= yeardays
[j
][i
/3];
492 pTzSpecificLocalTimeToSystemTime( cases
[i
].ptz
, &(cases
[i
].slt
), &result
);
493 ok( result
.wHour
== cases
[i
].ehour
,
494 "Test TzSpecificLocalTimeToSystemTime #%d. Got %4d-%02d-%02d %02d:%02d. Expect hour = %02d\n",
495 cases
[i
].nr
, result
.wYear
, result
.wMonth
, result
.wDay
,
496 result
.wHour
, result
.wMinute
, cases
[i
].ehour
);
500 /* SystemTimeToTzSpecificLocalTime */
501 { TZLT2ST_case cases
[] = {
502 /* standard->daylight transition */
503 { 1, &tzE
, {2004,3,-1,27,15,0,0,0}, 1 },
504 { 2, &tzE
, {2004,3,-1,27,15,59,59,999}, 1},
505 { 3, &tzE
, {2004,3,-1,27,16,0,0,0}, 3},
506 /* daylight->standard transition */
507 { 4, &tzE
, {2004,10,-1,30,15,0,0,0}, 2 },
508 { 5, &tzE
, {2004,10,-1,30,15,59,59,999}, 2 },
509 { 6, &tzE
, {2004,10,-1,30,16,0,0,0}, 2 },
510 /* West and with fixed weekday of the month */
511 { 7, &tzW
, {2004,4,-1,4,5,0,0,0}, 1},
512 { 8, &tzW
, {2004,4,-1,4,5,59,59,999}, 1},
513 { 9, &tzW
, {2004,4,-1,4,6,0,0,0}, 3},
514 { 10, &tzW
, {2004,10,-1,24,4,0,0,0}, 1},
515 { 11, &tzW
, {2004,10,-1,24,4,59,59,999}, 1},
516 { 12, &tzW
, {2004,10,-1,24,5,0,0,0 }, 1},
518 { 13, &tzS
, {2004,4,-1,4,4,0,0,0}, 1},
519 { 14, &tzS
, {2004,4,-1,4,4,59,59,999}, 1},
520 { 15, &tzS
, {2004,4,-1,4,5,0,0,0}, 1},
521 { 16, &tzS
, {2004,10,-1,24,5,0,0,0}, 1},
522 { 17, &tzS
, {2004,10,-1,24,5,59,59,999}, 1},
523 { 18, &tzS
, {2004,10,-1,24,6,0,0,0}, 3},
527 /* days of transitions to put into the cases array */
530 {27,30,4,24,4,24} /* 1999 */
531 , {25,28,2,22,2,22} /* 2000 */
532 , {24,27,1,28,1,28} /* 2001 */
533 , {30,26,7,27,7,27} /* 2002 */
534 , {29,25,6,26,6,26} /* 2003 */
535 , {27,30,4,24,4,24} /* 2004 */
536 , {26,29,3,23,3,23} /* 2005 */
537 , {25,28,2,22,2,22} /* 2006 */
538 , {24,27,1,28,1,28} /* 2007 */
539 , {29,25,6,26,6,26} /* 2008 */
540 , {28,24,5,25,5,25} /* 2009 */
541 , {27,30,4,24,4,24} /* 2010 */
542 , {26,29,3,23,3,23} /* 2011 */
543 , {24,27,1,28,1,28} /* 2012 */
544 , {30,26,7,27,7,27} /* 2013 */
545 , {29,25,6,26,6,26} /* 2014 */
546 , {28,24,5,25,5,25} /* 2015 */
547 , {26,29,3,23,3,23} /* 2016 */
548 , {25,28,2,22,2,22} /* 2017 */
549 , {24,27,1,28,1,28} /* 2018 */
550 , {30,26,7,27,7,27} /* 2019 */
552 for( j
=0 , year
= 1999; yeardays
[j
][0] ; j
++, year
++) {
553 for (i
=0; cases
[i
].nr
; i
++) {
554 if(i
) cases
[i
].nr
+= 18;
555 cases
[i
].slt
.wYear
= year
;
556 cases
[i
].slt
.wDay
= yeardays
[j
][i
/3];
557 pSystemTimeToTzSpecificLocalTime( cases
[i
].ptz
, &(cases
[i
].slt
), &result
);
558 ok( result
.wHour
== cases
[i
].ehour
,
559 "Test SystemTimeToTzSpecificLocalTime #%d. Got %4d-%02d-%02d %02d:%02d. Expect hour = %02d\n",
560 cases
[i
].nr
, result
.wYear
, result
.wMonth
, result
.wDay
,
561 result
.wHour
, result
.wMinute
, cases
[i
].ehour
);
572 test_GetTimeZoneInformation();
573 test_FileTimeToSystemTime();
574 test_FileTimeToLocalFileTime();
575 test_TzSpecificLocalTimeToSystemTime();