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"
25 static BOOL (WINAPI
*pTzSpecificLocalTimeToSystemTime
)(LPTIME_ZONE_INFORMATION
, LPSYSTEMTIME
, LPSYSTEMTIME
);
26 static BOOL (WINAPI
*pSystemTimeToTzSpecificLocalTime
)(LPTIME_ZONE_INFORMATION
, LPSYSTEMTIME
, LPSYSTEMTIME
);
29 #define SECSPERDAY 86400
30 /* 1601 to 1970 is 369 years plus 89 leap days */
31 #define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)SECSPERDAY)
32 #define TICKSPERSEC 10000000
33 #define TICKSPERMSEC 10000
34 #define TICKS_1601_TO_1970 (SECS_1601_TO_1970 * TICKSPERSEC)
37 #define NEWYEAR_1980_HI 0x01a8e79f
38 #define NEWYEAR_1980_LO 0xe1d58000
40 #define MAYDAY_2002_HI 0x01c1f107
41 #define MAYDAY_2002_LO 0xb82b6000
43 #define ATIME_HI 0x1c2349b
44 #define ATIME_LOW 0x580716b0
46 #define LOCAL_ATIME_HI 0x01c23471
47 #define LOCAL_ATIME_LOW 0x6f310eb0
49 #define DOS_DATE(y,m,d) ( (((y)-1980)<<9) | ((m)<<5) | (d) )
50 #define DOS_TIME(h,m,s) ( ((h)<<11) | ((m)<<5) | ((s)>>1) )
53 #define SETUP_1980(st) \
60 (st).wMilliseconds = 0;
62 #define SETUP_2002(st) \
69 (st).wMilliseconds = 0;
71 #define SETUP_ATIME(st) \
78 (st).wMilliseconds = 123;
80 #define SETUP_ZEROTIME(st) \
87 (st).wMilliseconds = 0;
89 #define SETUP_EARLY(st) \
96 (st).wMilliseconds = 999;
99 static void test_conversions(void)
104 memset(&ft
,0,sizeof ft
);
107 ok (!SystemTimeToFileTime(&st
, &ft
), "Conversion succeeded EARLY\n");
108 ok (GetLastError() == ERROR_INVALID_PARAMETER
, "EARLY should be INVALID\n");
111 ok (SystemTimeToFileTime(&st
, &ft
), "Conversion failed ZERO_TIME\n");
112 ok( (!((ft
.dwHighDateTime
!= 0) || (ft
.dwLowDateTime
!= 0))),
113 "Wrong time for ATIME: %08x %08x (correct %08x %08x)\n",
114 ft
.dwLowDateTime
, ft
.dwHighDateTime
, 0, 0);
118 ok (SystemTimeToFileTime(&st
,&ft
), "Conversion Failed ATIME\n");
119 ok( (!((ft
.dwHighDateTime
!= ATIME_HI
) || (ft
.dwLowDateTime
!=ATIME_LOW
))),
120 "Wrong time for ATIME: %08x %08x (correct %08x %08x)\n",
121 ft
.dwLowDateTime
, ft
.dwHighDateTime
, ATIME_LOW
, ATIME_HI
);
125 ok (SystemTimeToFileTime(&st
, &ft
), "Conversion failed 2002\n");
127 ok( (!((ft
.dwHighDateTime
!= MAYDAY_2002_HI
) ||
128 (ft
.dwLowDateTime
!=MAYDAY_2002_LO
))),
129 "Wrong time for 2002 %08x %08x (correct %08x %08x)\n", ft
.dwLowDateTime
,
130 ft
.dwHighDateTime
, MAYDAY_2002_LO
, MAYDAY_2002_HI
);
134 ok((SystemTimeToFileTime(&st
, &ft
)), "Conversion failed 1980\n");
136 ok( (!((ft
.dwHighDateTime
!=NEWYEAR_1980_HI
) ||
137 (ft
.dwLowDateTime
!=NEWYEAR_1980_LO
))) ,
138 "Wrong time for 1980 %08x %08x (correct %08x %08x)\n", ft
.dwLowDateTime
,
139 ft
.dwHighDateTime
, NEWYEAR_1980_LO
,NEWYEAR_1980_HI
);
141 ok(DosDateTimeToFileTime(DOS_DATE(1980,1,1),DOS_TIME(0,0,0),&ft
),
142 "DosDateTimeToFileTime() failed\n");
144 ok( (!((ft
.dwHighDateTime
!=NEWYEAR_1980_HI
) ||
145 (ft
.dwLowDateTime
!=NEWYEAR_1980_LO
))),
146 "Wrong time DosDateTimeToFileTime %08x %08x (correct %08x %08x)\n",
147 ft
.dwHighDateTime
, ft
.dwLowDateTime
, NEWYEAR_1980_HI
, NEWYEAR_1980_LO
);
151 static void test_invalid_arg(void)
157 /* Invalid argument checks */
159 memset(&ft
,0,sizeof ft
);
160 ok( DosDateTimeToFileTime(DOS_DATE(1980,1,1),DOS_TIME(0,0,0),&ft
), /* this is 1 Jan 1980 00:00:00 */
161 "DosDateTimeToFileTime() failed\n");
163 ok( (ft
.dwHighDateTime
==NEWYEAR_1980_HI
) && (ft
.dwLowDateTime
==NEWYEAR_1980_LO
),
164 "filetime for 1/1/80 00:00:00 was %08x %08x\n", ft
.dwHighDateTime
, ft
.dwLowDateTime
);
166 /* now check SystemTimeToFileTime */
167 memset(&ft
,0,sizeof ft
);
170 /* try with a bad month */
174 ok( !SystemTimeToFileTime(&st
, &ft
), "bad month\n");
176 /* with a bad hour */
180 ok( !SystemTimeToFileTime(&st
, &ft
), "bad hour\n");
182 /* with a bad minute */
186 ok( !SystemTimeToFileTime(&st
, &ft
), "bad minute\n");
189 static LONGLONG
system_time_to_minutes(const SYSTEMTIME
*st
)
195 SetLastError(0xdeadbeef);
196 ret
= SystemTimeToFileTime(st
, &ft
);
197 ok(ret
, "SystemTimeToFileTime error %u\n", GetLastError());
199 minutes
= ((LONGLONG
)ft
.dwHighDateTime
<< 32) + ft
.dwLowDateTime
;
200 minutes
/= (LONGLONG
)600000000; /* convert to minutes */
204 static LONG
get_tz_bias(const TIME_ZONE_INFORMATION
*tzinfo
, DWORD tz_id
)
208 case TIME_ZONE_ID_DAYLIGHT
:
209 return tzinfo
->DaylightBias
;
211 case TIME_ZONE_ID_STANDARD
:
212 return tzinfo
->StandardBias
;
215 trace("unknown time zone id %d\n", tz_id
);
217 case TIME_ZONE_ID_UNKNOWN
:
222 static void test_GetTimeZoneInformation(void)
224 TIME_ZONE_INFORMATION tzinfo
, tzinfo1
;
227 SYSTEMTIME st
, current
, utc
, local
;
229 LONGLONG l_time
, s_time
;
233 s_time
= system_time_to_minutes(&st
);
235 SetLastError(0xdeadbeef);
236 res
= SystemTimeToFileTime(&st
, &s_ft
);
237 ok(res
, "SystemTimeToFileTime error %u\n", GetLastError());
238 SetLastError(0xdeadbeef);
239 res
= FileTimeToLocalFileTime(&s_ft
, &l_ft
);
240 ok(res
, "FileTimeToLocalFileTime error %u\n", GetLastError());
241 SetLastError(0xdeadbeef);
242 res
= FileTimeToSystemTime(&l_ft
, &local
);
243 ok(res
, "FileTimeToSystemTime error %u\n", GetLastError());
244 l_time
= system_time_to_minutes(&local
);
246 tz_id
= GetTimeZoneInformation(&tzinfo
);
247 ok(tz_id
!= TIME_ZONE_ID_INVALID
, "GetTimeZoneInformation failed\n");
249 trace("bias %d\n", tzinfo
.Bias
);
250 trace("standard (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %d\n",
251 tzinfo
.StandardDate
.wDay
, tzinfo
.StandardDate
.wMonth
,
252 tzinfo
.StandardDate
.wYear
, tzinfo
.StandardDate
.wDayOfWeek
,
253 tzinfo
.StandardDate
.wHour
, tzinfo
.StandardDate
.wMinute
,
254 tzinfo
.StandardDate
.wSecond
, tzinfo
.StandardDate
.wMilliseconds
,
255 tzinfo
.StandardBias
);
256 trace("daylight (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %d\n",
257 tzinfo
.DaylightDate
.wDay
, tzinfo
.DaylightDate
.wMonth
,
258 tzinfo
.DaylightDate
.wYear
, tzinfo
.DaylightDate
.wDayOfWeek
,
259 tzinfo
.DaylightDate
.wHour
, tzinfo
.DaylightDate
.wMinute
,
260 tzinfo
.DaylightDate
.wSecond
, tzinfo
.DaylightDate
.wMilliseconds
,
261 tzinfo
.DaylightBias
);
263 diff
= (LONG
)(s_time
- l_time
);
264 ok(diff
== tzinfo
.Bias
+ get_tz_bias(&tzinfo
, tz_id
),
265 "system/local diff %d != tz bias %d\n",
266 diff
, tzinfo
.Bias
+ get_tz_bias(&tzinfo
, tz_id
));
268 ok(SetEnvironmentVariableA("TZ","GMT0") != 0,
269 "SetEnvironmentVariableA failed\n");
270 res
= GetTimeZoneInformation(&tzinfo1
);
271 ok(res
!= TIME_ZONE_ID_INVALID
, "GetTimeZoneInformation failed\n");
273 ok(((tzinfo
.Bias
== tzinfo1
.Bias
) &&
274 (tzinfo
.StandardBias
== tzinfo1
.StandardBias
) &&
275 (tzinfo
.DaylightBias
== tzinfo1
.DaylightBias
)),
276 "Bias influenced by TZ variable\n");
277 ok(SetEnvironmentVariableA("TZ",NULL
) != 0,
278 "SetEnvironmentVariableA failed\n");
280 diff
= get_tz_bias(&tzinfo
, tz_id
);
283 SetLastError(0xdeadbeef);
284 res
= pSystemTimeToTzSpecificLocalTime(&tzinfo
, &utc
, ¤t
);
285 ok(res
, "SystemTimeToTzSpecificLocalTime error %u\n", GetLastError());
286 s_time
= system_time_to_minutes(¤t
);
288 tzinfo
.StandardBias
-= 123;
289 tzinfo
.DaylightBias
+= 456;
291 res
= pSystemTimeToTzSpecificLocalTime(&tzinfo
, &utc
, &local
);
292 ok(res
, "SystemTimeToTzSpecificLocalTime error %u\n", GetLastError());
293 l_time
= system_time_to_minutes(&local
);
294 ok(l_time
- s_time
== diff
- get_tz_bias(&tzinfo
, tz_id
), "got %d, expected %d\n",
295 (LONG
)(l_time
- s_time
), diff
- get_tz_bias(&tzinfo
, tz_id
));
297 /* pretend that there is no transition dates */
298 tzinfo
.DaylightDate
.wDay
= 0;
299 tzinfo
.DaylightDate
.wMonth
= 0;
300 tzinfo
.DaylightDate
.wYear
= 0;
301 tzinfo
.StandardDate
.wDay
= 0;
302 tzinfo
.StandardDate
.wMonth
= 0;
303 tzinfo
.StandardDate
.wYear
= 0;
305 res
= pSystemTimeToTzSpecificLocalTime(&tzinfo
, &utc
, &local
);
306 ok(res
, "SystemTimeToTzSpecificLocalTime error %u\n", GetLastError());
307 l_time
= system_time_to_minutes(&local
);
308 ok(l_time
- s_time
== diff
, "got %d, expected %d\n",
309 (LONG
)(l_time
- s_time
), diff
);
312 static void test_FileTimeToSystemTime(void)
316 ULONGLONG time
= (ULONGLONG
)TICKSPERSEC
+ TICKS_1601_TO_1970
;
319 ft
.dwHighDateTime
= 0;
320 ft
.dwLowDateTime
= 0;
321 ret
= FileTimeToSystemTime(&ft
, &st
);
323 "FileTimeToSystemTime() failed with Error %d\n",GetLastError());
324 ok(((st
.wYear
== 1601) && (st
.wMonth
== 1) && (st
.wDay
== 1) &&
325 (st
.wHour
== 0) && (st
.wMinute
== 0) && (st
.wSecond
== 0) &&
326 (st
.wMilliseconds
== 0)),
327 "Got Year %4d Month %2d Day %2d\n", st
.wYear
, st
.wMonth
, st
.wDay
);
329 ft
.dwHighDateTime
= (UINT
)(time
>> 32);
330 ft
.dwLowDateTime
= (UINT
)time
;
331 ret
= FileTimeToSystemTime(&ft
, &st
);
333 "FileTimeToSystemTime() failed with Error %d\n",GetLastError());
334 ok(((st
.wYear
== 1970) && (st
.wMonth
== 1) && (st
.wDay
== 1) &&
335 (st
.wHour
== 0) && (st
.wMinute
== 0) && (st
.wSecond
== 1) &&
336 (st
.wMilliseconds
== 0)),
337 "Got Year %4d Month %2d Day %2d Hour %2d Min %2d Sec %2d mSec %3d\n",
338 st
.wYear
, st
.wMonth
, st
.wDay
, st
.wHour
, st
.wMinute
, st
.wSecond
,
342 static void test_FileTimeToLocalFileTime(void)
346 TIME_ZONE_INFORMATION tzinfo
;
347 DWORD res
= GetTimeZoneInformation(&tzinfo
);
348 ULONGLONG time
= (ULONGLONG
)TICKSPERSEC
+ TICKS_1601_TO_1970
+
349 (LONGLONG
)(tzinfo
.Bias
+
350 ( res
== TIME_ZONE_ID_STANDARD
? tzinfo
.StandardBias
:
351 ( res
== TIME_ZONE_ID_DAYLIGHT
? tzinfo
.DaylightBias
: 0 ))) *
352 SECSPERMIN
*TICKSPERSEC
;
355 ok( res
!= TIME_ZONE_ID_INVALID
, "GetTimeZoneInformation failed\n");
356 ft
.dwHighDateTime
= (UINT
)(time
>> 32);
357 ft
.dwLowDateTime
= (UINT
)time
;
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
,
369 ok(SetEnvironmentVariableA("TZ","GMT") != 0,
370 "SetEnvironmentVariableA failed\n");
371 ok(res
!= TIME_ZONE_ID_INVALID
, "GetTimeZoneInformation failed\n");
372 ret
= FileTimeToLocalFileTime(&ft
, &lft
);
374 "FileTimeToLocalFileTime() failed with Error %d\n",GetLastError());
375 FileTimeToSystemTime(&lft
, &st
);
376 ok(((st
.wYear
== 1970) && (st
.wMonth
== 1) && (st
.wDay
== 1) &&
377 (st
.wHour
== 0) && (st
.wMinute
== 0) && (st
.wSecond
== 1) &&
378 (st
.wMilliseconds
== 0)),
379 "Got Year %4d Month %2d Day %2d Hour %2d Min %2d Sec %2d mSec %3d\n",
380 st
.wYear
, st
.wMonth
, st
.wDay
, st
.wHour
, st
.wMinute
, st
.wSecond
,
382 ok(SetEnvironmentVariableA("TZ",NULL
) != 0,
383 "SetEnvironmentVariableA failed\n");
387 int nr
; /* test case number for easier lookup */
388 TIME_ZONE_INFORMATION
*ptz
; /* ptr to timezone */
389 SYSTEMTIME slt
; /* system/local time to convert */
390 WORD ehour
; /* expected hour */
393 static void test_TzSpecificLocalTimeToSystemTime(void)
395 TIME_ZONE_INFORMATION tzE
, tzW
, tzS
;
399 if (!pTzSpecificLocalTimeToSystemTime
|| !pSystemTimeToTzSpecificLocalTime
)
401 skip("TzSpecificLocalTimeToSystemTime or SystemTimeToTzSpecificLocalTime not present\n");
405 ZeroMemory( &tzE
, sizeof(tzE
));
406 ZeroMemory( &tzW
, sizeof(tzW
));
407 ZeroMemory( &tzS
, sizeof(tzS
));
408 /* timezone Eastern hemisphere */
411 tzE
.DaylightBias
=-60;
412 tzE
.StandardDate
.wMonth
=10;
413 tzE
.StandardDate
.wDayOfWeek
=0; /*sunday */
414 tzE
.StandardDate
.wDay
=5; /* last (sunday) of the month */
415 tzE
.StandardDate
.wHour
=3;
416 tzE
.DaylightDate
.wMonth
=3;
417 tzE
.DaylightDate
.wDay
=5;
418 tzE
.DaylightDate
.wHour
=2;
419 /* timezone Western hemisphere */
422 tzW
.DaylightBias
=-60;
423 tzW
.StandardDate
.wMonth
=10;
424 tzW
.StandardDate
.wDayOfWeek
=0; /*sunday */
425 tzW
.StandardDate
.wDay
=4; /* 4th (sunday) of the month */
426 tzW
.StandardDate
.wHour
=2;
427 tzW
.DaylightDate
.wMonth
=4;
428 tzW
.DaylightDate
.wDay
=1;
429 tzW
.DaylightDate
.wHour
=2;
430 /* timezone Eastern hemisphere */
433 tzS
.DaylightBias
=-60;
434 tzS
.StandardDate
.wMonth
=4;
435 tzS
.StandardDate
.wDayOfWeek
=0; /*sunday */
436 tzS
.StandardDate
.wDay
=1; /* 1st (sunday) of the month */
437 tzS
.StandardDate
.wHour
=2;
438 tzS
.DaylightDate
.wMonth
=10;
439 tzS
.DaylightDate
.wDay
=4;
440 tzS
.DaylightDate
.wHour
=2;
442 /* TzSpecificLocalTimeToSystemTime */
443 { TZLT2ST_case cases
[] = {
444 /* standard->daylight transition */
445 { 1, &tzE
, {2004,3,-1,28,1,0,0,0}, 15 },
446 { 2, &tzE
, {2004,3,-1,28,1,59,59,999}, 15},
447 { 3, &tzE
, {2004,3,-1,28,2,0,0,0}, 15},
448 /* daylight->standard transition */
449 { 4, &tzE
, {2004,10,-1,31,2,0,0,0} , 15 },
450 { 5, &tzE
, {2004,10,-1,31,2,59,59,999}, 15 },
451 { 6, &tzE
, {2004,10,-1,31,3,0,0,0}, 17 },
452 /* West and with fixed weekday of the month */
453 { 7, &tzW
, {2004,4,-1,4,1,0,0,0}, 5},
454 { 8, &tzW
, {2004,4,-1,4,1,59,59,999}, 5},
455 { 9, &tzW
, {2004,4,-1,4,2,0,0,0}, 5},
456 { 10, &tzW
, {2004,10,-1,24,1,0,0,0}, 4},
457 { 11, &tzW
, {2004,10,-1,24,1,59,59,999}, 4},
458 { 12, &tzW
, {2004,10,-1,24,2,0,0,0 }, 6},
460 { 13, &tzS
, {2004,4,-1,4,1,0,0,0}, 4},
461 { 14, &tzS
, {2004,4,-1,4,1,59,59,999}, 4},
462 { 15, &tzS
, {2004,4,-1,4,2,0,0,0}, 6},
463 { 16, &tzS
, {2004,10,-1,24,1,0,0,0}, 5},
464 { 17, &tzS
, {2004,10,-1,24,1,59,59,999}, 5},
465 { 18, &tzS
, {2004,10,-1,24,2,0,0,0}, 5},
468 /* days of transitions to put into the cases array */
471 {28,31,4,24,4,24} /* 1999 */
472 , {26,29,2,22,2,22} /* 2000 */
473 , {25,28,1,28,1,28} /* 2001 */
474 , {31,27,7,27,7,27} /* 2002 */
475 , {30,26,6,26,6,26} /* 2003 */
476 , {28,31,4,24,4,24} /* 2004 */
477 , {27,30,3,23,3,23} /* 2005 */
478 , {26,29,2,22,2,22} /* 2006 */
479 , {25,28,1,28,1,28} /* 2007 */
480 , {30,26,6,26,6,26} /* 2008 */
481 , {29,25,5,25,5,25} /* 2009 */
482 , {28,31,4,24,4,24} /* 2010 */
483 , {27,30,3,23,3,23} /* 2011 */
484 , {25,28,1,28,1,28} /* 2012 */
485 , {31,27,7,27,7,27} /* 2013 */
486 , {30,26,6,26,6,26} /* 2014 */
487 , {29,25,5,25,5,25} /* 2015 */
488 , {27,30,3,23,3,23} /* 2016 */
489 , {26,29,2,22,2,22} /* 2017 */
490 , {25,28,1,28,1,28} /* 2018 */
491 , {31,27,7,27,7,27} /* 2019 */
494 for( j
=0 , year
= 1999; yeardays
[j
][0] ; j
++, year
++) {
495 for (i
=0; cases
[i
].nr
; i
++) {
496 if(i
) cases
[i
].nr
+= 18;
497 cases
[i
].slt
.wYear
= year
;
498 cases
[i
].slt
.wDay
= yeardays
[j
][i
/3];
499 pTzSpecificLocalTimeToSystemTime( cases
[i
].ptz
, &(cases
[i
].slt
), &result
);
500 ok( result
.wHour
== cases
[i
].ehour
,
501 "Test TzSpecificLocalTimeToSystemTime #%d. Got %4d-%02d-%02d %02d:%02d. Expect hour = %02d\n",
502 cases
[i
].nr
, result
.wYear
, result
.wMonth
, result
.wDay
,
503 result
.wHour
, result
.wMinute
, cases
[i
].ehour
);
507 /* SystemTimeToTzSpecificLocalTime */
508 { TZLT2ST_case cases
[] = {
509 /* standard->daylight transition */
510 { 1, &tzE
, {2004,3,-1,27,15,0,0,0}, 1 },
511 { 2, &tzE
, {2004,3,-1,27,15,59,59,999}, 1},
512 { 3, &tzE
, {2004,3,-1,27,16,0,0,0}, 3},
513 /* daylight->standard transition */
514 { 4, &tzE
, {2004,10,-1,30,15,0,0,0}, 2 },
515 { 5, &tzE
, {2004,10,-1,30,15,59,59,999}, 2 },
516 { 6, &tzE
, {2004,10,-1,30,16,0,0,0}, 2 },
517 /* West and with fixed weekday of the month */
518 { 7, &tzW
, {2004,4,-1,4,5,0,0,0}, 1},
519 { 8, &tzW
, {2004,4,-1,4,5,59,59,999}, 1},
520 { 9, &tzW
, {2004,4,-1,4,6,0,0,0}, 3},
521 { 10, &tzW
, {2004,10,-1,24,4,0,0,0}, 1},
522 { 11, &tzW
, {2004,10,-1,24,4,59,59,999}, 1},
523 { 12, &tzW
, {2004,10,-1,24,5,0,0,0 }, 1},
525 { 13, &tzS
, {2004,4,-1,4,4,0,0,0}, 1},
526 { 14, &tzS
, {2004,4,-1,4,4,59,59,999}, 1},
527 { 15, &tzS
, {2004,4,-1,4,5,0,0,0}, 1},
528 { 16, &tzS
, {2004,10,-1,24,5,0,0,0}, 1},
529 { 17, &tzS
, {2004,10,-1,24,5,59,59,999}, 1},
530 { 18, &tzS
, {2004,10,-1,24,6,0,0,0}, 3},
534 /* days of transitions to put into the cases array */
537 {27,30,4,24,4,24} /* 1999 */
538 , {25,28,2,22,2,22} /* 2000 */
539 , {24,27,1,28,1,28} /* 2001 */
540 , {30,26,7,27,7,27} /* 2002 */
541 , {29,25,6,26,6,26} /* 2003 */
542 , {27,30,4,24,4,24} /* 2004 */
543 , {26,29,3,23,3,23} /* 2005 */
544 , {25,28,2,22,2,22} /* 2006 */
545 , {24,27,1,28,1,28} /* 2007 */
546 , {29,25,6,26,6,26} /* 2008 */
547 , {28,24,5,25,5,25} /* 2009 */
548 , {27,30,4,24,4,24} /* 2010 */
549 , {26,29,3,23,3,23} /* 2011 */
550 , {24,27,1,28,1,28} /* 2012 */
551 , {30,26,7,27,7,27} /* 2013 */
552 , {29,25,6,26,6,26} /* 2014 */
553 , {28,24,5,25,5,25} /* 2015 */
554 , {26,29,3,23,3,23} /* 2016 */
555 , {25,28,2,22,2,22} /* 2017 */
556 , {24,27,1,28,1,28} /* 2018 */
557 , {30,26,7,27,7,27} /* 2019 */
559 for( j
=0 , year
= 1999; yeardays
[j
][0] ; j
++, year
++) {
560 for (i
=0; cases
[i
].nr
; i
++) {
561 if(i
) cases
[i
].nr
+= 18;
562 cases
[i
].slt
.wYear
= year
;
563 cases
[i
].slt
.wDay
= yeardays
[j
][i
/3];
564 pSystemTimeToTzSpecificLocalTime( cases
[i
].ptz
, &(cases
[i
].slt
), &result
);
565 ok( result
.wHour
== cases
[i
].ehour
,
566 "Test SystemTimeToTzSpecificLocalTime #%d. Got %4d-%02d-%02d %02d:%02d. Expect hour = %02d\n",
567 cases
[i
].nr
, result
.wYear
, result
.wMonth
, result
.wDay
,
568 result
.wHour
, result
.wMinute
, cases
[i
].ehour
);
577 HMODULE hKernel
= GetModuleHandle("kernel32");
578 pTzSpecificLocalTimeToSystemTime
= (void *)GetProcAddress(hKernel
, "TzSpecificLocalTimeToSystemTime");
579 pSystemTimeToTzSpecificLocalTime
= (void *)GetProcAddress( hKernel
, "SystemTimeToTzSpecificLocalTime");
583 test_GetTimeZoneInformation();
584 test_FileTimeToSystemTime();
585 test_FileTimeToLocalFileTime();
586 test_TzSpecificLocalTimeToSystemTime();