2 * Unit test suite for time functions
4 * Copyright 2004 Uwe Bonnes
5 * Copyright 2007 Dmitry Timoshkov
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/test.h"
26 static BOOL (WINAPI *pTzSpecificLocalTimeToSystemTime)(LPTIME_ZONE_INFORMATION, LPSYSTEMTIME, LPSYSTEMTIME);
27 static BOOL (WINAPI *pSystemTimeToTzSpecificLocalTime)(LPTIME_ZONE_INFORMATION, LPSYSTEMTIME, LPSYSTEMTIME);
30 #define SECSPERDAY 86400
31 /* 1601 to 1970 is 369 years plus 89 leap days */
32 #define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)SECSPERDAY)
33 #define TICKSPERSEC 10000000
34 #define TICKSPERMSEC 10000
35 #define TICKS_1601_TO_1970 (SECS_1601_TO_1970 * TICKSPERSEC)
38 #define NEWYEAR_1980_HI 0x01a8e79f
39 #define NEWYEAR_1980_LO 0xe1d58000
41 #define MAYDAY_2002_HI 0x01c1f107
42 #define MAYDAY_2002_LO 0xb82b6000
44 #define ATIME_HI 0x1c2349b
45 #define ATIME_LOW 0x580716b0
47 #define LOCAL_ATIME_HI 0x01c23471
48 #define LOCAL_ATIME_LOW 0x6f310eb0
50 #define DOS_DATE(y,m,d) ( (((y)-1980)<<9) | ((m)<<5) | (d) )
51 #define DOS_TIME(h,m,s) ( ((h)<<11) | ((m)<<5) | ((s)>>1) )
54 #define SETUP_1980(st) \
61 (st).wMilliseconds = 0;
63 #define SETUP_2002(st) \
70 (st).wMilliseconds = 0;
72 #define SETUP_ATIME(st) \
79 (st).wMilliseconds = 123;
81 #define SETUP_ZEROTIME(st) \
88 (st).wMilliseconds = 0;
90 #define SETUP_EARLY(st) \
97 (st).wMilliseconds = 999;
100 static void test_conversions(void)
105 memset(&ft,0,sizeof ft);
108 ok (!SystemTimeToFileTime(&st, &ft), "Conversion succeeded EARLY\n");
109 ok (GetLastError() == ERROR_INVALID_PARAMETER, "EARLY should be INVALID\n");
112 ok (SystemTimeToFileTime(&st, &ft), "Conversion failed ZERO_TIME\n");
113 ok( (!((ft.dwHighDateTime != 0) || (ft.dwLowDateTime != 0))),
114 "Wrong time for ATIME: %08x %08x (correct %08x %08x)\n",
115 ft.dwLowDateTime, ft.dwHighDateTime, 0, 0);
119 ok (SystemTimeToFileTime(&st,&ft), "Conversion Failed ATIME\n");
120 ok( (!((ft.dwHighDateTime != ATIME_HI) || (ft.dwLowDateTime!=ATIME_LOW))),
121 "Wrong time for ATIME: %08x %08x (correct %08x %08x)\n",
122 ft.dwLowDateTime, ft.dwHighDateTime, ATIME_LOW, ATIME_HI);
126 ok (SystemTimeToFileTime(&st, &ft), "Conversion failed 2002\n");
128 ok( (!((ft.dwHighDateTime != MAYDAY_2002_HI) ||
129 (ft.dwLowDateTime!=MAYDAY_2002_LO))),
130 "Wrong time for 2002 %08x %08x (correct %08x %08x)\n", ft.dwLowDateTime,
131 ft.dwHighDateTime, MAYDAY_2002_LO, MAYDAY_2002_HI);
135 ok((SystemTimeToFileTime(&st, &ft)), "Conversion failed 1980\n");
137 ok( (!((ft.dwHighDateTime!=NEWYEAR_1980_HI) ||
138 (ft.dwLowDateTime!=NEWYEAR_1980_LO))) ,
139 "Wrong time for 1980 %08x %08x (correct %08x %08x)\n", ft.dwLowDateTime,
140 ft.dwHighDateTime, NEWYEAR_1980_LO,NEWYEAR_1980_HI );
142 ok(DosDateTimeToFileTime(DOS_DATE(1980,1,1),DOS_TIME(0,0,0),&ft),
143 "DosDateTimeToFileTime() failed\n");
145 ok( (!((ft.dwHighDateTime!=NEWYEAR_1980_HI) ||
146 (ft.dwLowDateTime!=NEWYEAR_1980_LO))),
147 "Wrong time DosDateTimeToFileTime %08x %08x (correct %08x %08x)\n",
148 ft.dwHighDateTime, ft.dwLowDateTime, NEWYEAR_1980_HI, NEWYEAR_1980_LO);
152 static void test_invalid_arg(void)
158 /* Invalid argument checks */
160 memset(&ft,0,sizeof ft);
161 ok( DosDateTimeToFileTime(DOS_DATE(1980,1,1),DOS_TIME(0,0,0),&ft), /* this is 1 Jan 1980 00:00:00 */
162 "DosDateTimeToFileTime() failed\n");
164 ok( (ft.dwHighDateTime==NEWYEAR_1980_HI) && (ft.dwLowDateTime==NEWYEAR_1980_LO),
165 "filetime for 1/1/80 00:00:00 was %08x %08x\n", ft.dwHighDateTime, ft.dwLowDateTime);
167 /* now check SystemTimeToFileTime */
168 memset(&ft,0,sizeof ft);
171 /* try with a bad month */
175 ok( !SystemTimeToFileTime(&st, &ft), "bad month\n");
177 /* with a bad hour */
181 ok( !SystemTimeToFileTime(&st, &ft), "bad hour\n");
183 /* with a bad minute */
187 ok( !SystemTimeToFileTime(&st, &ft), "bad minute\n");
190 static LONGLONG system_time_to_minutes(const SYSTEMTIME *st)
196 SetLastError(0xdeadbeef);
197 ret = SystemTimeToFileTime(st, &ft);
198 ok(ret, "SystemTimeToFileTime error %u\n", GetLastError());
200 minutes = ((LONGLONG)ft.dwHighDateTime << 32) + ft.dwLowDateTime;
201 minutes /= (LONGLONG)600000000; /* convert to minutes */
205 static LONG get_tz_bias(const TIME_ZONE_INFORMATION *tzinfo, DWORD tz_id)
209 case TIME_ZONE_ID_DAYLIGHT:
210 return tzinfo->DaylightBias;
212 case TIME_ZONE_ID_STANDARD:
213 return tzinfo->StandardBias;
216 trace("unknown time zone id %d\n", tz_id);
218 case TIME_ZONE_ID_UNKNOWN:
223 static void test_GetTimeZoneInformation(void)
225 char std_name[32], dlt_name[32];
226 TIME_ZONE_INFORMATION tzinfo, tzinfo1;
229 SYSTEMTIME st, current, utc, local;
231 LONGLONG l_time, s_time;
235 s_time = system_time_to_minutes(&st);
237 SetLastError(0xdeadbeef);
238 res = SystemTimeToFileTime(&st, &s_ft);
239 ok(res, "SystemTimeToFileTime error %u\n", GetLastError());
240 SetLastError(0xdeadbeef);
241 res = FileTimeToLocalFileTime(&s_ft, &l_ft);
242 ok(res, "FileTimeToLocalFileTime error %u\n", GetLastError());
243 SetLastError(0xdeadbeef);
244 res = FileTimeToSystemTime(&l_ft, &local);
245 ok(res, "FileTimeToSystemTime error %u\n", GetLastError());
246 l_time = system_time_to_minutes(&local);
248 tz_id = GetTimeZoneInformation(&tzinfo);
249 ok(tz_id != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed\n");
251 trace("tz_id %u (%s)\n", tz_id,
252 tz_id == TIME_ZONE_ID_DAYLIGHT ? "TIME_ZONE_ID_DAYLIGHT" :
253 (tz_id == TIME_ZONE_ID_STANDARD ? "TIME_ZONE_ID_STANDARD" :
254 (tz_id == TIME_ZONE_ID_UNKNOWN ? "TIME_ZONE_ID_UNKNOWN" :
255 "TIME_ZONE_ID_INVALID")));
257 WideCharToMultiByte(CP_ACP, 0, tzinfo.StandardName, -1, std_name, sizeof(std_name), NULL, NULL);
258 WideCharToMultiByte(CP_ACP, 0, tzinfo.DaylightName, -1, dlt_name, sizeof(dlt_name), NULL, NULL);
259 trace("bias %d, %s - %s\n", tzinfo.Bias, std_name, dlt_name);
260 trace("standard (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %d\n",
261 tzinfo.StandardDate.wDay, tzinfo.StandardDate.wMonth,
262 tzinfo.StandardDate.wYear, tzinfo.StandardDate.wDayOfWeek,
263 tzinfo.StandardDate.wHour, tzinfo.StandardDate.wMinute,
264 tzinfo.StandardDate.wSecond, tzinfo.StandardDate.wMilliseconds,
265 tzinfo.StandardBias);
266 trace("daylight (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %d\n",
267 tzinfo.DaylightDate.wDay, tzinfo.DaylightDate.wMonth,
268 tzinfo.DaylightDate.wYear, tzinfo.DaylightDate.wDayOfWeek,
269 tzinfo.DaylightDate.wHour, tzinfo.DaylightDate.wMinute,
270 tzinfo.DaylightDate.wSecond, tzinfo.DaylightDate.wMilliseconds,
271 tzinfo.DaylightBias);
273 diff = (LONG)(s_time - l_time);
274 ok(diff == tzinfo.Bias + get_tz_bias(&tzinfo, tz_id),
275 "system/local diff %d != tz bias %d\n",
276 diff, tzinfo.Bias + get_tz_bias(&tzinfo, tz_id));
278 ok(SetEnvironmentVariableA("TZ","GMT0") != 0,
279 "SetEnvironmentVariableA failed\n");
280 res = GetTimeZoneInformation(&tzinfo1);
281 ok(res != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed\n");
283 ok(((tzinfo.Bias == tzinfo1.Bias) &&
284 (tzinfo.StandardBias == tzinfo1.StandardBias) &&
285 (tzinfo.DaylightBias == tzinfo1.DaylightBias)),
286 "Bias influenced by TZ variable\n");
287 ok(SetEnvironmentVariableA("TZ",NULL) != 0,
288 "SetEnvironmentVariableA failed\n");
290 if (!pSystemTimeToTzSpecificLocalTime)
292 skip("SystemTimeToTzSpecificLocalTime not present\n");
296 diff = get_tz_bias(&tzinfo, tz_id);
299 SetLastError(0xdeadbeef);
300 res = pSystemTimeToTzSpecificLocalTime(&tzinfo, &utc, ¤t);
301 ok(res, "SystemTimeToTzSpecificLocalTime error %u\n", GetLastError());
302 s_time = system_time_to_minutes(¤t);
304 tzinfo.StandardBias -= 123;
305 tzinfo.DaylightBias += 456;
307 res = pSystemTimeToTzSpecificLocalTime(&tzinfo, &utc, &local);
308 ok(res, "SystemTimeToTzSpecificLocalTime error %u\n", GetLastError());
309 l_time = system_time_to_minutes(&local);
310 ok(l_time - s_time == diff - get_tz_bias(&tzinfo, tz_id), "got %d, expected %d\n",
311 (LONG)(l_time - s_time), diff - get_tz_bias(&tzinfo, tz_id));
313 /* pretend that there is no transition dates */
314 tzinfo.DaylightDate.wDay = 0;
315 tzinfo.DaylightDate.wMonth = 0;
316 tzinfo.DaylightDate.wYear = 0;
317 tzinfo.StandardDate.wDay = 0;
318 tzinfo.StandardDate.wMonth = 0;
319 tzinfo.StandardDate.wYear = 0;
321 res = pSystemTimeToTzSpecificLocalTime(&tzinfo, &utc, &local);
322 ok(res, "SystemTimeToTzSpecificLocalTime error %u\n", GetLastError());
323 l_time = system_time_to_minutes(&local);
324 ok(l_time - s_time == diff, "got %d, expected %d\n",
325 (LONG)(l_time - s_time), diff);
328 static void test_FileTimeToSystemTime(void)
332 ULONGLONG time = (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970;
335 ft.dwHighDateTime = 0;
336 ft.dwLowDateTime = 0;
337 ret = FileTimeToSystemTime(&ft, &st);
339 "FileTimeToSystemTime() failed with Error %d\n",GetLastError());
340 ok(((st.wYear == 1601) && (st.wMonth == 1) && (st.wDay == 1) &&
341 (st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 0) &&
342 (st.wMilliseconds == 0)),
343 "Got Year %4d Month %2d Day %2d\n", st.wYear, st.wMonth, st.wDay);
345 ft.dwHighDateTime = (UINT)(time >> 32);
346 ft.dwLowDateTime = (UINT)time;
347 ret = FileTimeToSystemTime(&ft, &st);
349 "FileTimeToSystemTime() failed with Error %d\n",GetLastError());
350 ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) &&
351 (st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 1) &&
352 (st.wMilliseconds == 0)),
353 "Got Year %4d Month %2d Day %2d Hour %2d Min %2d Sec %2d mSec %3d\n",
354 st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond,
358 static void test_FileTimeToLocalFileTime(void)
362 TIME_ZONE_INFORMATION tzinfo;
363 DWORD res = GetTimeZoneInformation(&tzinfo);
364 ULONGLONG time = (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970 +
365 (LONGLONG)(tzinfo.Bias +
366 ( res == TIME_ZONE_ID_STANDARD ? tzinfo.StandardBias :
367 ( res == TIME_ZONE_ID_DAYLIGHT ? tzinfo.DaylightBias : 0 ))) *
368 SECSPERMIN *TICKSPERSEC;
371 ok( res != TIME_ZONE_ID_INVALID , "GetTimeZoneInformation failed\n");
372 ft.dwHighDateTime = (UINT)(time >> 32);
373 ft.dwLowDateTime = (UINT)time;
374 ret = FileTimeToLocalFileTime(&ft, &lft);
376 "FileTimeToLocalFileTime() failed with Error %d\n",GetLastError());
377 FileTimeToSystemTime(&lft, &st);
378 ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) &&
379 (st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 1) &&
380 (st.wMilliseconds == 0)),
381 "Got Year %4d Month %2d Day %2d Hour %2d Min %2d Sec %2d mSec %3d\n",
382 st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond,
385 ok(SetEnvironmentVariableA("TZ","GMT") != 0,
386 "SetEnvironmentVariableA failed\n");
387 ok(res != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed\n");
388 ret = FileTimeToLocalFileTime(&ft, &lft);
390 "FileTimeToLocalFileTime() failed with Error %d\n",GetLastError());
391 FileTimeToSystemTime(&lft, &st);
392 ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) &&
393 (st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 1) &&
394 (st.wMilliseconds == 0)),
395 "Got Year %4d Month %2d Day %2d Hour %2d Min %2d Sec %2d mSec %3d\n",
396 st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond,
398 ok(SetEnvironmentVariableA("TZ",NULL) != 0,
399 "SetEnvironmentVariableA failed\n");
403 int nr; /* test case number for easier lookup */
404 TIME_ZONE_INFORMATION *ptz; /* ptr to timezone */
405 SYSTEMTIME slt; /* system/local time to convert */
406 WORD ehour; /* expected hour */
409 static void test_TzSpecificLocalTimeToSystemTime(void)
411 TIME_ZONE_INFORMATION tzE, tzW, tzS;
415 if (!pTzSpecificLocalTimeToSystemTime || !pSystemTimeToTzSpecificLocalTime)
417 skip("TzSpecificLocalTimeToSystemTime or SystemTimeToTzSpecificLocalTime not present\n");
421 ZeroMemory( &tzE, sizeof(tzE));
422 ZeroMemory( &tzW, sizeof(tzW));
423 ZeroMemory( &tzS, sizeof(tzS));
424 /* timezone Eastern hemisphere */
427 tzE.DaylightBias=-60;
428 tzE.StandardDate.wMonth=10;
429 tzE.StandardDate.wDayOfWeek=0; /*sunday */
430 tzE.StandardDate.wDay=5; /* last (sunday) of the month */
431 tzE.StandardDate.wHour=3;
432 tzE.DaylightDate.wMonth=3;
433 tzE.DaylightDate.wDay=5;
434 tzE.DaylightDate.wHour=2;
435 /* timezone Western hemisphere */
438 tzW.DaylightBias=-60;
439 tzW.StandardDate.wMonth=10;
440 tzW.StandardDate.wDayOfWeek=0; /*sunday */
441 tzW.StandardDate.wDay=4; /* 4th (sunday) of the month */
442 tzW.StandardDate.wHour=2;
443 tzW.DaylightDate.wMonth=4;
444 tzW.DaylightDate.wDay=1;
445 tzW.DaylightDate.wHour=2;
446 /* timezone Eastern hemisphere */
449 tzS.DaylightBias=-60;
450 tzS.StandardDate.wMonth=4;
451 tzS.StandardDate.wDayOfWeek=0; /*sunday */
452 tzS.StandardDate.wDay=1; /* 1st (sunday) of the month */
453 tzS.StandardDate.wHour=2;
454 tzS.DaylightDate.wMonth=10;
455 tzS.DaylightDate.wDay=4;
456 tzS.DaylightDate.wHour=2;
458 /* TzSpecificLocalTimeToSystemTime */
459 { TZLT2ST_case cases[] = {
460 /* standard->daylight transition */
461 { 1, &tzE, {2004,3,-1,28,1,0,0,0}, 15 },
462 { 2, &tzE, {2004,3,-1,28,1,59,59,999}, 15},
463 { 3, &tzE, {2004,3,-1,28,2,0,0,0}, 15},
464 /* daylight->standard transition */
465 { 4, &tzE, {2004,10,-1,31,2,0,0,0} , 15 },
466 { 5, &tzE, {2004,10,-1,31,2,59,59,999}, 15 },
467 { 6, &tzE, {2004,10,-1,31,3,0,0,0}, 17 },
468 /* West and with fixed weekday of the month */
469 { 7, &tzW, {2004,4,-1,4,1,0,0,0}, 5},
470 { 8, &tzW, {2004,4,-1,4,1,59,59,999}, 5},
471 { 9, &tzW, {2004,4,-1,4,2,0,0,0}, 5},
472 { 10, &tzW, {2004,10,-1,24,1,0,0,0}, 4},
473 { 11, &tzW, {2004,10,-1,24,1,59,59,999}, 4},
474 { 12, &tzW, {2004,10,-1,24,2,0,0,0 }, 6},
476 { 13, &tzS, {2004,4,-1,4,1,0,0,0}, 4},
477 { 14, &tzS, {2004,4,-1,4,1,59,59,999}, 4},
478 { 15, &tzS, {2004,4,-1,4,2,0,0,0}, 6},
479 { 16, &tzS, {2004,10,-1,24,1,0,0,0}, 5},
480 { 17, &tzS, {2004,10,-1,24,1,59,59,999}, 5},
481 { 18, &tzS, {2004,10,-1,24,2,0,0,0}, 5},
484 /* days of transitions to put into the cases array */
487 {28,31,4,24,4,24} /* 1999 */
488 , {26,29,2,22,2,22} /* 2000 */
489 , {25,28,1,28,1,28} /* 2001 */
490 , {31,27,7,27,7,27} /* 2002 */
491 , {30,26,6,26,6,26} /* 2003 */
492 , {28,31,4,24,4,24} /* 2004 */
493 , {27,30,3,23,3,23} /* 2005 */
494 , {26,29,2,22,2,22} /* 2006 */
495 , {25,28,1,28,1,28} /* 2007 */
496 , {30,26,6,26,6,26} /* 2008 */
497 , {29,25,5,25,5,25} /* 2009 */
498 , {28,31,4,24,4,24} /* 2010 */
499 , {27,30,3,23,3,23} /* 2011 */
500 , {25,28,1,28,1,28} /* 2012 */
501 , {31,27,7,27,7,27} /* 2013 */
502 , {30,26,6,26,6,26} /* 2014 */
503 , {29,25,5,25,5,25} /* 2015 */
504 , {27,30,3,23,3,23} /* 2016 */
505 , {26,29,2,22,2,22} /* 2017 */
506 , {25,28,1,28,1,28} /* 2018 */
507 , {31,27,7,27,7,27} /* 2019 */
510 for( j=0 , year = 1999; yeardays[j][0] ; j++, year++) {
511 for (i=0; cases[i].nr; i++) {
512 if(i) cases[i].nr += 18;
513 cases[i].slt.wYear = year;
514 cases[i].slt.wDay = yeardays[j][i/3];
515 pTzSpecificLocalTimeToSystemTime( cases[i].ptz, &(cases[i].slt), &result);
516 ok( result.wHour == cases[i].ehour,
517 "Test TzSpecificLocalTimeToSystemTime #%d. Got %4d-%02d-%02d %02d:%02d. Expect hour = %02d\n",
518 cases[i].nr, result.wYear, result.wMonth, result.wDay,
519 result.wHour, result.wMinute, cases[i].ehour);
523 /* SystemTimeToTzSpecificLocalTime */
524 { TZLT2ST_case cases[] = {
525 /* standard->daylight transition */
526 { 1, &tzE, {2004,3,-1,27,15,0,0,0}, 1 },
527 { 2, &tzE, {2004,3,-1,27,15,59,59,999}, 1},
528 { 3, &tzE, {2004,3,-1,27,16,0,0,0}, 3},
529 /* daylight->standard transition */
530 { 4, &tzE, {2004,10,-1,30,15,0,0,0}, 2 },
531 { 5, &tzE, {2004,10,-1,30,15,59,59,999}, 2 },
532 { 6, &tzE, {2004,10,-1,30,16,0,0,0}, 2 },
533 /* West and with fixed weekday of the month */
534 { 7, &tzW, {2004,4,-1,4,5,0,0,0}, 1},
535 { 8, &tzW, {2004,4,-1,4,5,59,59,999}, 1},
536 { 9, &tzW, {2004,4,-1,4,6,0,0,0}, 3},
537 { 10, &tzW, {2004,10,-1,24,4,0,0,0}, 1},
538 { 11, &tzW, {2004,10,-1,24,4,59,59,999}, 1},
539 { 12, &tzW, {2004,10,-1,24,5,0,0,0 }, 1},
541 { 13, &tzS, {2004,4,-1,4,4,0,0,0}, 1},
542 { 14, &tzS, {2004,4,-1,4,4,59,59,999}, 1},
543 { 15, &tzS, {2004,4,-1,4,5,0,0,0}, 1},
544 { 16, &tzS, {2004,10,-1,24,5,0,0,0}, 1},
545 { 17, &tzS, {2004,10,-1,24,5,59,59,999}, 1},
546 { 18, &tzS, {2004,10,-1,24,6,0,0,0}, 3},
550 /* days of transitions to put into the cases array */
553 {27,30,4,24,4,24} /* 1999 */
554 , {25,28,2,22,2,22} /* 2000 */
555 , {24,27,1,28,1,28} /* 2001 */
556 , {30,26,7,27,7,27} /* 2002 */
557 , {29,25,6,26,6,26} /* 2003 */
558 , {27,30,4,24,4,24} /* 2004 */
559 , {26,29,3,23,3,23} /* 2005 */
560 , {25,28,2,22,2,22} /* 2006 */
561 , {24,27,1,28,1,28} /* 2007 */
562 , {29,25,6,26,6,26} /* 2008 */
563 , {28,24,5,25,5,25} /* 2009 */
564 , {27,30,4,24,4,24} /* 2010 */
565 , {26,29,3,23,3,23} /* 2011 */
566 , {24,27,1,28,1,28} /* 2012 */
567 , {30,26,7,27,7,27} /* 2013 */
568 , {29,25,6,26,6,26} /* 2014 */
569 , {28,24,5,25,5,25} /* 2015 */
570 , {26,29,3,23,3,23} /* 2016 */
571 , {25,28,2,22,2,22} /* 2017 */
572 , {24,27,1,28,1,28} /* 2018 */
573 , {30,26,7,27,7,27} /* 2019 */
575 for( j=0 , year = 1999; yeardays[j][0] ; j++, year++) {
576 for (i=0; cases[i].nr; i++) {
577 if(i) cases[i].nr += 18;
578 cases[i].slt.wYear = year;
579 cases[i].slt.wDay = yeardays[j][i/3];
580 pSystemTimeToTzSpecificLocalTime( cases[i].ptz, &(cases[i].slt), &result);
581 ok( result.wHour == cases[i].ehour,
582 "Test SystemTimeToTzSpecificLocalTime #%d. Got %4d-%02d-%02d %02d:%02d. Expect hour = %02d\n",
583 cases[i].nr, result.wYear, result.wMonth, result.wDay,
584 result.wHour, result.wMinute, cases[i].ehour);
593 HMODULE hKernel = GetModuleHandle("kernel32");
594 pTzSpecificLocalTimeToSystemTime = (void *)GetProcAddress(hKernel, "TzSpecificLocalTimeToSystemTime");
595 pSystemTimeToTzSpecificLocalTime = (void *)GetProcAddress( hKernel, "SystemTimeToTzSpecificLocalTime");
599 test_GetTimeZoneInformation();
600 test_FileTimeToSystemTime();
601 test_FileTimeToLocalFileTime();
602 test_TzSpecificLocalTimeToSystemTime();