ReactOS 0.4.15-dev-7934-g1dc8d80
time.c
Go to the documentation of this file.
1/*
2 * Unit test suite for time functions.
3 *
4 * Copyright 2004 Uwe Bonnes
5 *
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.
10 *
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.
15 *
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
19 */
20
21#include "wine/test.h"
22#include "winbase.h"
23#include "winnls.h"
24#include "time.h"
25
26#include <stdlib.h> /*setenv*/
27#include <stdio.h> /*printf*/
28#include <locale.h>
29#include <errno.h>
30
31#define _MAX__TIME64_T (((__time64_t)0x00000007 << 32) | 0x93406FFF)
32
33#define SECSPERDAY 86400
34#define SECSPERHOUR 3600
35#define SECSPERMIN 60
36#define MINSPERHOUR 60
37#define HOURSPERDAY 24
38
39static __time32_t (__cdecl *p_mkgmtime32)(struct tm*);
40static struct tm* (__cdecl *p_gmtime32)(__time32_t*);
41static struct tm* (__cdecl *p_gmtime)(time_t*);
42static errno_t (__cdecl *p_gmtime32_s)(struct tm*, __time32_t*);
43static errno_t (__cdecl *p_strtime_s)(char*,size_t);
44static errno_t (__cdecl *p_strdate_s)(char*,size_t);
45static errno_t (__cdecl *p_localtime32_s)(struct tm*, __time32_t*);
46static errno_t (__cdecl *p_localtime64_s)(struct tm*, __time64_t*);
47static int* (__cdecl *p__daylight)(void);
48static int* (__cdecl *p___p__daylight)(void);
49static long* (__cdecl *p___p__dstbias)(void);
50static long* (__cdecl *p__dstbias)(void);
51static long* (__cdecl *p___p__timezone)(void);
52static size_t (__cdecl *p_strftime)(char *, size_t, const char *, const struct tm *);
53static size_t (__cdecl *p_wcsftime)(wchar_t *, size_t, const wchar_t *, const struct tm *);
54static char* (__cdecl *p_asctime)(const struct tm *);
55
56static void init(void)
57{
58 HMODULE hmod = LoadLibraryA("msvcrt.dll");
59
60 p_gmtime32 = (void*)GetProcAddress(hmod, "_gmtime32");
61 p_gmtime = (void*)GetProcAddress(hmod, "gmtime");
62 p_gmtime32_s = (void*)GetProcAddress(hmod, "_gmtime32_s");
63 p_mkgmtime32 = (void*)GetProcAddress(hmod, "_mkgmtime32");
64 p_strtime_s = (void*)GetProcAddress(hmod, "_strtime_s");
65 p_strdate_s = (void*)GetProcAddress(hmod, "_strdate_s");
66 p_localtime32_s = (void*)GetProcAddress(hmod, "_localtime32_s");
67 p_localtime64_s = (void*)GetProcAddress(hmod, "_localtime64_s");
68 p__daylight = (void*)GetProcAddress(hmod, "__daylight");
69 p___p__daylight = (void*)GetProcAddress(hmod, "__p__daylight");
70 p___p__dstbias = (void*)GetProcAddress(hmod, "__p__dstbias");
71 p__dstbias = (void*)GetProcAddress(hmod, "__dstbias");
72 p___p__timezone = (void*)GetProcAddress(hmod, "__p__timezone");
73 p_strftime = (void*)GetProcAddress(hmod, "strftime");
74 p_wcsftime = (void*)GetProcAddress(hmod, "wcsftime");
75 p_asctime = (void*)GetProcAddress(hmod, "asctime");
76}
77
79{
81 struct tm *tm = localtime(&now);
82
83 /* compute start of year in seconds */
84 *start = SECSPERDAY * ((tm->tm_year - 70) * 365 +
85 (tm->tm_year - 69) / 4 -
86 (tm->tm_year - 1) / 100 +
87 (tm->tm_year + 299) / 400);
88 return tm->tm_year;
89}
90
91static void test_ctime(void)
92{
93 time_t badtime = -1;
94 char* ret;
95 ret = ctime(&badtime);
96 ok(ret == NULL, "expected ctime to return NULL, got %s\n", ret);
97}
98static void test_gmtime(void)
99{
100 __time32_t valid, gmt;
101 struct tm* gmt_tm, gmt_tm_s;
102 errno_t err;
103
104 if(!p_gmtime32) {
105 win_skip("Skipping _gmtime32 tests\n");
106 return;
107 }
108
109 gmt_tm = p_gmtime32(NULL);
110 ok(gmt_tm == NULL, "gmt_tm != NULL\n");
111
112 gmt = -1;
113 gmt_tm = p_gmtime32(&gmt);
114 ok(gmt_tm==NULL || broken(gmt_tm->tm_year==70 && gmt_tm->tm_sec<0), "gmt_tm != NULL\n");
115
116 gmt = valid = 0;
117 gmt_tm = p_gmtime32(&gmt);
118 if(!gmt_tm) {
119 ok(0, "_gmtime32() failed\n");
120 return;
121 }
122
123 ok(((gmt_tm->tm_year == 70) && (gmt_tm->tm_mon == 0) && (gmt_tm->tm_yday == 0) &&
124 (gmt_tm->tm_mday == 1) && (gmt_tm->tm_wday == 4) && (gmt_tm->tm_hour == 0) &&
125 (gmt_tm->tm_min == 0) && (gmt_tm->tm_sec == 0) && (gmt_tm->tm_isdst == 0)),
126 "Wrong date:Year %4d mon %2d yday %3d mday %2d wday %1d hour%2d min %2d sec %2d dst %2d\n",
127 gmt_tm->tm_year, gmt_tm->tm_mon, gmt_tm->tm_yday, gmt_tm->tm_mday, gmt_tm->tm_wday,
128 gmt_tm->tm_hour, gmt_tm->tm_min, gmt_tm->tm_sec, gmt_tm->tm_isdst);
129
130 if(!p_mkgmtime32) {
131 win_skip("Skipping _mkgmtime32 tests\n");
132 return;
133 }
134
135 gmt_tm->tm_wday = gmt_tm->tm_yday = 0;
136 gmt = p_mkgmtime32(gmt_tm);
137 ok(gmt == valid, "gmt = %u\n", gmt);
138 ok(gmt_tm->tm_wday == 4, "gmt_tm->tm_wday = %d\n", gmt_tm->tm_wday);
139 ok(gmt_tm->tm_yday == 0, "gmt_tm->tm_yday = %d\n", gmt_tm->tm_yday);
140
141 gmt_tm->tm_wday = gmt_tm->tm_yday = 0;
142 gmt_tm->tm_isdst = -1;
143 gmt = p_mkgmtime32(gmt_tm);
144 ok(gmt == valid, "gmt = %u\n", gmt);
145 ok(gmt_tm->tm_wday == 4, "gmt_tm->tm_wday = %d\n", gmt_tm->tm_wday);
146 ok(gmt_tm->tm_yday == 0, "gmt_tm->tm_yday = %d\n", gmt_tm->tm_yday);
147
148 gmt_tm->tm_wday = gmt_tm->tm_yday = 0;
149 gmt_tm->tm_isdst = 1;
150 gmt = p_mkgmtime32(gmt_tm);
151 ok(gmt == valid, "gmt = %u\n", gmt);
152 ok(gmt_tm->tm_wday == 4, "gmt_tm->tm_wday = %d\n", gmt_tm->tm_wday);
153 ok(gmt_tm->tm_yday == 0, "gmt_tm->tm_yday = %d\n", gmt_tm->tm_yday);
154
155 gmt = valid = 173921;
156 gmt_tm = p_gmtime32(&gmt);
157 if(!gmt_tm) {
158 ok(0, "_gmtime32() failed\n");
159 return;
160 }
161
162 gmt_tm->tm_isdst = -1;
163 gmt = p_mkgmtime32(gmt_tm);
164 ok(gmt == valid, "gmt = %u\n", gmt);
165 ok(gmt_tm->tm_wday == 6, "gmt_tm->tm_wday = %d\n", gmt_tm->tm_wday);
166 ok(gmt_tm->tm_yday == 2, "gmt_tm->tm_yday = %d\n", gmt_tm->tm_yday);
167
168 gmt_tm->tm_isdst = 1;
169 gmt = p_mkgmtime32(gmt_tm);
170 ok(gmt == valid, "gmt = %u\n", gmt);
171
172 if(!p_gmtime32_s) {
173 win_skip("Skipping _gmtime32_s tests\n");
174 return;
175 }
176
177 errno = 0;
178 gmt = 0;
179 err = p_gmtime32_s(NULL, &gmt);
180 ok(err == EINVAL, "err = %d\n", err);
181 ok(errno == EINVAL, "errno = %d\n", errno);
182
183 errno = 0;
184 gmt = -1;
185 err = p_gmtime32_s(&gmt_tm_s, &gmt);
186 ok(gmt_tm_s.tm_year == -1 || broken(gmt_tm_s.tm_year == 70 && gmt_tm_s.tm_sec < 0),
187 "tm_year = %d, tm_sec = %d\n", gmt_tm_s.tm_year, gmt_tm_s.tm_sec);
188 if(gmt_tm_s.tm_year == -1) {
189 ok(err==EINVAL, "err = %d\n", err);
190 ok(errno==EINVAL, "errno = %d\n", errno);
191 }
192}
193
194static void test_mktime(void)
195{
198 struct tm my_tm, sav_tm;
199 time_t nulltime, local_time;
200 char TZ_env[256];
201 char buffer[64];
202 int year;
203 time_t ref, secs;
204
205 year = get_test_year( &ref );
206 ref += SECSPERDAY;
207
208 ok (res != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed\n");
209 WideCharToMultiByte( CP_ACP, 0, tzinfo.StandardName, -1, buffer, sizeof(buffer), NULL, NULL );
210 trace( "bias %d std %d dst %d zone %s\n",
211 tzinfo.Bias, tzinfo.StandardBias, tzinfo.DaylightBias, buffer );
212 /* Bias may be positive or negative, to use offset of one day */
213 my_tm = *localtime(&ref); /* retrieve current dst flag */
214 secs = SECSPERDAY - tzinfo.Bias * SECSPERMIN;
215 secs -= (my_tm.tm_isdst ? tzinfo.DaylightBias : tzinfo.StandardBias) * SECSPERMIN;
216 my_tm.tm_mday = 1 + secs/SECSPERDAY;
217 secs = secs % SECSPERDAY;
218 my_tm.tm_hour = secs / SECSPERHOUR;
219 secs = secs % SECSPERHOUR;
220 my_tm.tm_min = secs / SECSPERMIN;
221 secs = secs % SECSPERMIN;
222 my_tm.tm_sec = secs;
223
224 my_tm.tm_year = year;
225 my_tm.tm_mon = 0;
226
227 sav_tm = my_tm;
228
229 local_time = mktime(&my_tm);
230 ok(local_time == ref, "mktime returned %u, expected %u\n",
232 /* now test some unnormalized struct tm's */
233 my_tm = sav_tm;
234 my_tm.tm_sec += 60;
235 my_tm.tm_min -= 1;
236 local_time = mktime(&my_tm);
237 ok(local_time == ref, "Unnormalized mktime returned %u, expected %u\n",
239 ok( my_tm.tm_year == sav_tm.tm_year && my_tm.tm_mon == sav_tm.tm_mon &&
240 my_tm.tm_mday == sav_tm.tm_mday && my_tm.tm_hour == sav_tm.tm_hour &&
241 my_tm.tm_sec == sav_tm.tm_sec,
242 "mktime returned %2d-%02d-%02d %02d:%02d expected %2d-%02d-%02d %02d:%02d\n",
243 my_tm.tm_year,my_tm.tm_mon,my_tm.tm_mday,
244 my_tm.tm_hour,my_tm.tm_sec,
245 sav_tm.tm_year,sav_tm.tm_mon,sav_tm.tm_mday,
246 sav_tm.tm_hour,sav_tm.tm_sec);
247 my_tm = sav_tm;
248 my_tm.tm_min -= 60;
249 my_tm.tm_hour += 1;
250 local_time = mktime(&my_tm);
251 ok(local_time == ref, "Unnormalized mktime returned %u, expected %u\n",
253 ok( my_tm.tm_year == sav_tm.tm_year && my_tm.tm_mon == sav_tm.tm_mon &&
254 my_tm.tm_mday == sav_tm.tm_mday && my_tm.tm_hour == sav_tm.tm_hour &&
255 my_tm.tm_sec == sav_tm.tm_sec,
256 "mktime returned %2d-%02d-%02d %02d:%02d expected %2d-%02d-%02d %02d:%02d\n",
257 my_tm.tm_year,my_tm.tm_mon,my_tm.tm_mday,
258 my_tm.tm_hour,my_tm.tm_sec,
259 sav_tm.tm_year,sav_tm.tm_mon,sav_tm.tm_mday,
260 sav_tm.tm_hour,sav_tm.tm_sec);
261 my_tm = sav_tm;
262 my_tm.tm_mon -= 12;
263 my_tm.tm_year += 1;
264 local_time = mktime(&my_tm);
265 ok(local_time == ref, "Unnormalized mktime returned %u, expected %u\n",
267 ok( my_tm.tm_year == sav_tm.tm_year && my_tm.tm_mon == sav_tm.tm_mon &&
268 my_tm.tm_mday == sav_tm.tm_mday && my_tm.tm_hour == sav_tm.tm_hour &&
269 my_tm.tm_sec == sav_tm.tm_sec,
270 "mktime returned %2d-%02d-%02d %02d:%02d expected %2d-%02d-%02d %02d:%02d\n",
271 my_tm.tm_year,my_tm.tm_mon,my_tm.tm_mday,
272 my_tm.tm_hour,my_tm.tm_sec,
273 sav_tm.tm_year,sav_tm.tm_mon,sav_tm.tm_mday,
274 sav_tm.tm_hour,sav_tm.tm_sec);
275 my_tm = sav_tm;
276 my_tm.tm_mon += 12;
277 my_tm.tm_year -= 1;
278 local_time = mktime(&my_tm);
279 ok(local_time == ref, "Unnormalized mktime returned %u, expected %u\n",
281 ok( my_tm.tm_year == sav_tm.tm_year && my_tm.tm_mon == sav_tm.tm_mon &&
282 my_tm.tm_mday == sav_tm.tm_mday && my_tm.tm_hour == sav_tm.tm_hour &&
283 my_tm.tm_sec == sav_tm.tm_sec,
284 "mktime returned %2d-%02d-%02d %02d:%02d expected %2d-%02d-%02d %02d:%02d\n",
285 my_tm.tm_year,my_tm.tm_mon,my_tm.tm_mday,
286 my_tm.tm_hour,my_tm.tm_sec,
287 sav_tm.tm_year,sav_tm.tm_mon,sav_tm.tm_mday,
288 sav_tm.tm_hour,sav_tm.tm_sec);
289 /* now a bad time example */
290 my_tm = sav_tm;
291 my_tm.tm_year = 69;
292 local_time = mktime(&my_tm);
293 ok((local_time == -1), "(bad time) mktime returned %d, expected -1\n", (int)local_time);
294
295 my_tm = sav_tm;
296 /* TEST that we are independent from the TZ variable */
297 /*Argh, msvcrt doesn't have setenv() */
298 _snprintf(TZ_env,255,"TZ=%s",(getenv("TZ")?getenv("TZ"):""));
299 putenv("TZ=GMT");
300 nulltime = mktime(&my_tm);
301 ok(nulltime == ref,"mktime returned 0x%08x\n",(DWORD)nulltime);
302 putenv(TZ_env);
303}
304
305static void test_localtime(void)
306{
309 time_t gmt, ref;
310
311 char TZ_env[256];
312 struct tm* lt;
313 int year = get_test_year( &ref );
314 int is_leap = !(year % 4) && ((year % 100) || !((year + 300) % 400));
315
316 gmt = ref + SECSPERDAY + tzinfo.Bias * SECSPERMIN;
317 ok (res != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed\n");
318 lt = localtime(&gmt);
319 gmt += (lt->tm_isdst ? tzinfo.DaylightBias : tzinfo.StandardBias) * SECSPERMIN;
320 lt = localtime(&gmt);
321 ok(((lt->tm_year == year) && (lt->tm_mon == 0) && (lt->tm_yday == 1) &&
322 (lt->tm_mday == 2) && (lt->tm_hour == 0) &&
323 (lt->tm_min == 0) && (lt->tm_sec == 0)),
324 "Wrong date:Year %d mon %d yday %d mday %d wday %d hour %d min %d sec %d dst %d\n",
325 lt->tm_year, lt->tm_mon, lt->tm_yday, lt->tm_mday, lt->tm_wday, lt->tm_hour,
326 lt->tm_min, lt->tm_sec, lt->tm_isdst);
327
328 _snprintf(TZ_env,255,"TZ=%s",(getenv("TZ")?getenv("TZ"):""));
329 putenv("TZ=GMT");
330 lt = localtime(&gmt);
331 ok(((lt->tm_year == year) && (lt->tm_mon == 0) && (lt->tm_yday == 1) &&
332 (lt->tm_mday == 2) && (lt->tm_hour == 0) &&
333 (lt->tm_min == 0) && (lt->tm_sec == 0)),
334 "Wrong date:Year %d mon %d yday %d mday %d wday %d hour %d min %d sec %d dst %d\n",
335 lt->tm_year, lt->tm_mon, lt->tm_yday, lt->tm_mday, lt->tm_wday, lt->tm_hour,
336 lt->tm_min, lt->tm_sec, lt->tm_isdst);
337 putenv(TZ_env);
338
339 /* June 22 */
340 gmt = ref + 202 * SECSPERDAY + tzinfo.Bias * SECSPERMIN;
341 lt = localtime(&gmt);
342 gmt += (lt->tm_isdst ? tzinfo.DaylightBias : tzinfo.StandardBias) * SECSPERMIN;
343 lt = localtime(&gmt);
344 ok(((lt->tm_year == year) && (lt->tm_mon == 6) && (lt->tm_yday == 202) &&
345 (lt->tm_mday == 22 - is_leap) && (lt->tm_hour == 0) &&
346 (lt->tm_min == 0) && (lt->tm_sec == 0)),
347 "Wrong date:Year %d mon %d yday %d mday %d wday %d hour %d min %d sec %d dst %d\n",
348 lt->tm_year, lt->tm_mon, lt->tm_yday, lt->tm_mday, lt->tm_wday, lt->tm_hour,
349 lt->tm_min, lt->tm_sec, lt->tm_isdst);
350}
351
352static void test_strdate(void)
353{
354 char date[16], * result;
355 int month, day, year, count, len;
356 errno_t err;
357
359 ok(result == date, "Wrong return value\n");
360 len = strlen(date);
361 ok(len == 8, "Wrong length: returned %d, should be 8\n", len);
362 count = sscanf(date, "%02d/%02d/%02d", &month, &day, &year);
363 ok(count == 3, "Wrong format: count = %d, should be 3\n", count);
364
365 if(!p_strdate_s) {
366 win_skip("Skipping _strdate_s tests\n");
367 return;
368 }
369
370 errno = 0;
371 err = p_strdate_s(NULL, 1);
372 ok(err == EINVAL, "err = %d\n", err);
373 ok(errno == EINVAL, "errno = %d\n", errno);
374
375 date[0] = 'x';
376 date[1] = 'x';
377 err = p_strdate_s(date, 8);
378 ok(err == ERANGE, "err = %d\n", err);
379 ok(errno == ERANGE, "errno = %d\n", errno);
380 ok(date[0] == '\0', "date[0] != '\\0'\n");
381 ok(date[1] == 'x', "date[1] != 'x'\n");
382
383 err = p_strdate_s(date, 9);
384 ok(err == 0, "err = %x\n", err);
385}
386
387static void test_strtime(void)
388{
389 char time[16], * result;
390 int hour, minute, second, count, len;
391 errno_t err;
392
394 ok(result == time, "Wrong return value\n");
395 len = strlen(time);
396 ok(len == 8, "Wrong length: returned %d, should be 8\n", len);
397 count = sscanf(time, "%02d:%02d:%02d", &hour, &minute, &second);
398 ok(count == 3, "Wrong format: count = %d, should be 3\n", count);
399
400 if(!p_strtime_s) {
401 win_skip("Skipping _strtime_s tests\n");
402 return;
403 }
404
405 errno = 0;
406 err = p_strtime_s(NULL, 0);
407 ok(err == EINVAL, "err = %d\n", err);
408 ok(errno == EINVAL, "errno = %d\n", errno);
409
410 err = p_strtime_s(NULL, 1);
411 ok(err == EINVAL, "err = %d\n", err);
412 ok(errno == EINVAL, "errno = %d\n", errno);
413
414 time[0] = 'x';
415 err = p_strtime_s(time, 8);
416 ok(err == ERANGE, "err = %d\n", err);
417 ok(errno == ERANGE, "errno = %d\n", errno);
418 ok(time[0] == '\0', "time[0] != '\\0'\n");
419
420 err = p_strtime_s(time, 9);
421 ok(err == 0, "err = %x\n", err);
422}
423
424static void test_wstrdate(void)
425{
426 wchar_t date[16], * result;
427 int month, day, year, count, len;
428 wchar_t format[] = { '%','0','2','d','/','%','0','2','d','/','%','0','2','d',0 };
429
431 ok(result == date, "Wrong return value\n");
432 len = wcslen(date);
433 ok(len == 8, "Wrong length: returned %d, should be 8\n", len);
434 count = swscanf(date, format, &month, &day, &year);
435 ok(count == 3, "Wrong format: count = %d, should be 3\n", count);
436}
437
438static void test_wstrtime(void)
439{
440 wchar_t time[16], * result;
441 int hour, minute, second, count, len;
442 wchar_t format[] = { '%','0','2','d',':','%','0','2','d',':','%','0','2','d',0 };
443
445 ok(result == time, "Wrong return value\n");
446 len = wcslen(time);
447 ok(len == 8, "Wrong length: returned %d, should be 8\n", len);
448 count = swscanf(time, format, &hour, &minute, &second);
449 ok(count == 3, "Wrong format: count = %d, should be 3\n", count);
450}
451
452static void test_localtime32_s(void)
453{
454 struct tm tm;
456 errno_t err;
457
458 if (!p_localtime32_s)
459 {
460 win_skip("Skipping _localtime32_s tests\n");
461 return;
462 }
463
464 errno = EBADF;
465 err = p_localtime32_s(NULL, NULL);
466 ok(err == EINVAL, "Expected _localtime32_s to return EINVAL, got %d\n", err);
467 ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
468
469 errno = EBADF;
470 time = 0x12345678;
471 err = p_localtime32_s(NULL, &time);
472 ok(err == EINVAL, "Expected _localtime32_s to return EINVAL, got %d\n", err);
473 ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
474
475 memset(&tm, 0, sizeof(tm));
476 errno = EBADF;
477 err = p_localtime32_s(&tm, NULL);
478 ok(err == EINVAL, "Expected _localtime32_s to return EINVAL, got %d\n", err);
479 ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
480 ok(tm.tm_sec == -1 && tm.tm_min == -1 && tm.tm_hour == -1 &&
481 tm.tm_mday == -1 && tm.tm_mon == -1 && tm.tm_year == -1 &&
482 tm.tm_wday == -1 && tm.tm_yday == -1 && tm.tm_isdst == -1,
483 "Expected tm structure members to be initialized to -1, got "
484 "(%d, %d, %d, %d, %d, %d, %d, %d, %d)\n", tm.tm_sec, tm.tm_min,
486 tm.tm_isdst);
487
488 memset(&tm, 0, sizeof(tm));
489 time = -1;
490 errno = EBADF;
491 err = p_localtime32_s(&tm, &time);
492 ok(err == EINVAL, "Expected _localtime32_s to return EINVAL, got %d\n", err);
493 ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
494 ok(tm.tm_sec == -1 && tm.tm_min == -1 && tm.tm_hour == -1 &&
495 tm.tm_mday == -1 && tm.tm_mon == -1 && tm.tm_year == -1 &&
496 tm.tm_wday == -1 && tm.tm_yday == -1 && tm.tm_isdst == -1,
497 "Expected tm structure members to be initialized to -1, got "
498 "(%d, %d, %d, %d, %d, %d, %d, %d, %d)\n", tm.tm_sec, tm.tm_min,
500 tm.tm_isdst);
501}
502
503static void test_localtime64_s(void)
504{
505 struct tm tm;
506 __time64_t time;
507 errno_t err;
508
509 if (!p_localtime64_s)
510 {
511 win_skip("Skipping _localtime64_s tests\n");
512 return;
513 }
514
515 errno = EBADF;
516 err = p_localtime64_s(NULL, NULL);
517 ok(err == EINVAL, "Expected _localtime64_s to return EINVAL, got %d\n", err);
518 ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
519
520 errno = EBADF;
521 time = 0xdeadbeef;
522 err = p_localtime64_s(NULL, &time);
523 ok(err == EINVAL, "Expected _localtime64_s to return EINVAL, got %d\n", err);
524 ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
525
526 memset(&tm, 0, sizeof(tm));
527 errno = EBADF;
528 err = p_localtime64_s(&tm, NULL);
529 ok(err == EINVAL, "Expected _localtime64_s to return EINVAL, got %d\n", err);
530 ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
531 ok(tm.tm_sec == -1 && tm.tm_min == -1 && tm.tm_hour == -1 &&
532 tm.tm_mday == -1 && tm.tm_mon == -1 && tm.tm_year == -1 &&
533 tm.tm_wday == -1 && tm.tm_yday == -1 && tm.tm_isdst == -1,
534 "Expected tm structure members to be initialized to -1, got "
535 "(%d, %d, %d, %d, %d, %d, %d, %d, %d)\n", tm.tm_sec, tm.tm_min,
537 tm.tm_isdst);
538
539 memset(&tm, 0, sizeof(tm));
540 time = -1;
541 errno = EBADF;
542 err = p_localtime64_s(&tm, &time);
543 ok(err == EINVAL, "Expected _localtime64_s to return EINVAL, got %d\n", err);
544 ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
545 ok(tm.tm_sec == -1 && tm.tm_min == -1 && tm.tm_hour == -1 &&
546 tm.tm_mday == -1 && tm.tm_mon == -1 && tm.tm_year == -1 &&
547 tm.tm_wday == -1 && tm.tm_yday == -1 && tm.tm_isdst == -1,
548 "Expected tm structure members to be initialized to -1, got "
549 "(%d, %d, %d, %d, %d, %d, %d, %d, %d)\n", tm.tm_sec, tm.tm_min,
551 tm.tm_isdst);
552
553 memset(&tm, 0, sizeof(tm));
554 time = _MAX__TIME64_T + 1;
555 errno = EBADF;
556 err = p_localtime64_s(&tm, &time);
557 ok(err == EINVAL, "Expected _localtime64_s to return EINVAL, got %d\n", err);
558 ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
559 ok(tm.tm_sec == -1 && tm.tm_min == -1 && tm.tm_hour == -1 &&
560 tm.tm_mday == -1 && tm.tm_mon == -1 && tm.tm_year == -1 &&
561 tm.tm_wday == -1 && tm.tm_yday == -1 && tm.tm_isdst == -1,
562 "Expected tm structure members to be initialized to -1, got "
563 "(%d, %d, %d, %d, %d, %d, %d, %d, %d)\n", tm.tm_sec, tm.tm_min,
565 tm.tm_isdst);
566}
567
568static void test_daylight(void)
569{
570 int *ret1, *ret2;
571
572 if (!p__daylight)
573 {
574 win_skip("__daylight() not available\n");
575 return;
576 }
577
578 if (!p___p__daylight)
579 {
580 skip("__p__daylight not available\n");
581 return;
582 }
583
584 ret1 = p__daylight();
585 ret2 = p___p__daylight();
586 ok(ret1 && ret1 == ret2, "got %p\n", ret1);
587}
588
589static void test_strftime(void)
590{
591 static const wchar_t cW[] = { '%','c',0 };
592 static const char expected[] = "01/01/70 00:00:00";
593 time_t gmt;
594 struct tm* gmt_tm;
595 char buf[256], bufA[256];
596 WCHAR bufW[256];
597 long retA, retW;
598
599 if (!p_strftime || !p_wcsftime || !p_gmtime)
600 {
601 win_skip("strftime, wcsftime or gmtime is not available\n");
602 return;
603 }
604
605 setlocale(LC_TIME, "C");
606
607 gmt = 0;
608 gmt_tm = p_gmtime(&gmt);
609 ok(gmt_tm != NULL, "gmtime failed\n");
610
611 errno = 0xdeadbeef;
612 retA = p_strftime(bufA, 256, "%C", gmt_tm);
613 ok(retA == 0, "expected 0, got %ld\n", retA);
614 ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
615
616 errno = 0xdeadbeef;
617 retA = p_strftime(bufA, 256, "%D", gmt_tm);
618 ok(retA == 0, "expected 0, got %ld\n", retA);
619 ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
620
621 errno = 0xdeadbeef;
622 retA = p_strftime(bufA, 256, "%e", gmt_tm);
623 ok(retA == 0, "expected 0, got %ld\n", retA);
624 ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
625
626 errno = 0xdeadbeef;
627 retA = p_strftime(bufA, 256, "%F", gmt_tm);
628 ok(retA == 0, "expected 0, got %ld\n", retA);
629 ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
630
631 errno = 0xdeadbeef;
632 retA = p_strftime(bufA, 256, "%h", gmt_tm);
633 ok(retA == 0, "expected 0, got %ld\n", retA);
634 ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
635
636 errno = 0xdeadbeef;
637 retA = p_strftime(bufA, 256, "%n", gmt_tm);
638 ok(retA == 0, "expected 0, got %ld\n", retA);
639 ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
640
641 errno = 0xdeadbeef;
642 retA = p_strftime(bufA, 256, "%R", gmt_tm);
643 ok(retA == 0, "expected 0, got %ld\n", retA);
644 ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
645
646 errno = 0xdeadbeef;
647 retA = p_strftime(bufA, 256, "%t", gmt_tm);
648 ok(retA == 0, "expected 0, got %ld\n", retA);
649 ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
650
651 errno = 0xdeadbeef;
652 retA = p_strftime(bufA, 256, "%T", gmt_tm);
653 ok(retA == 0, "expected 0, got %ld\n", retA);
654 ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
655
656 errno = 0xdeadbeef;
657 retA = p_strftime(bufA, 256, "%u", gmt_tm);
658 ok(retA == 0, "expected 0, got %ld\n", retA);
659 ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
660
661 errno = 0xdeadbeef;
662 retA = p_strftime(NULL, 0, "copy", gmt_tm);
663 ok(retA == 0, "expected 0, got %ld\n", retA);
664 ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
665
666 retA = p_strftime(bufA, 256, "copy", NULL);
667 ok(retA == 4, "expected 4, got %ld\n", retA);
668 ok(!strcmp(bufA, "copy"), "got %s\n", bufA);
669
670 retA = p_strftime(bufA, 256, "copy it", gmt_tm);
671 ok(retA == 7, "expected 7, got %ld\n", retA);
672 ok(!strcmp(bufA, "copy it"), "got %s\n", bufA);
673
674 errno = 0xdeadbeef;
675 retA = p_strftime(bufA, 2, "copy", gmt_tm);
676 ok(retA == 0, "expected 0, got %ld\n", retA);
677 ok(!strcmp(bufA, "") || broken(!strcmp(bufA, "copy it")), "got %s\n", bufA);
678 ok(errno==ERANGE || errno==0xdeadbeef, "errno = %d\n", errno);
679
680 errno = 0xdeadbeef;
681 retA = p_strftime(bufA, 256, "a%e", gmt_tm);
682 ok(retA==0 || broken(retA==1), "expected 0, got %ld\n", retA);
683 ok(!strcmp(bufA, "") || broken(!strcmp(bufA, "a")), "got %s\n", bufA);
684 ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
685
686 if(0) { /* crashes on Win2k */
687 errno = 0xdeadbeef;
688 retA = p_strftime(bufA, 256, "%c", NULL);
689 ok(retA == 0, "expected 0, got %ld\n", retA);
690 ok(!strcmp(bufA, ""), "got %s\n", bufA);
691 ok(errno == EINVAL, "errno = %d\n", errno);
692 }
693
694 retA = p_strftime(bufA, 256, "e%#%e", gmt_tm);
695 ok(retA == 3, "expected 3, got %ld\n", retA);
696 ok(!strcmp(bufA, "e%e"), "got %s\n", bufA);
697
698 retA = p_strftime(bufA, 256, "%c", gmt_tm);
699 ok(retA == 17, "expected 17, got %ld\n", retA);
700 ok(strcmp(bufA, expected) == 0, "expected %s, got %s\n", expected, bufA);
701
702 retW = p_wcsftime(bufW, 256, cW, gmt_tm);
703 ok(retW == 17, "expected 17, got %ld\n", retW);
704 ok(retA == retW, "expected %ld, got %ld\n", retA, retW);
705 buf[0] = 0;
706 retA = WideCharToMultiByte(CP_ACP, 0, bufW, retW, buf, 256, NULL, NULL);
707 buf[retA] = 0;
708 ok(strcmp(bufA, buf) == 0, "expected %s, got %s\n", bufA, buf);
709
710 retA = p_strftime(bufA, 256, "%x", gmt_tm);
711 ok(retA == 8, "expected 8, got %ld\n", retA);
712 ok(!strcmp(bufA, "01/01/70"), "got %s\n", bufA);
713
714 retA = p_strftime(bufA, 256, "%X", gmt_tm);
715 ok(retA == 8, "expected 8, got %ld\n", retA);
716 ok(!strcmp(bufA, "00:00:00"), "got %s\n", bufA);
717
718 retA = p_strftime(bufA, 256, "%a", gmt_tm);
719 ok(retA == 3, "expected 3, got %ld\n", retA);
720 ok(!strcmp(bufA, "Thu"), "got %s\n", bufA);
721
722 retA = p_strftime(bufA, 256, "%A", gmt_tm);
723 ok(retA == 8, "expected 8, got %ld\n", retA);
724 ok(!strcmp(bufA, "Thursday"), "got %s\n", bufA);
725
726 retA = p_strftime(bufA, 256, "%b", gmt_tm);
727 ok(retA == 3, "expected 3, got %ld\n", retA);
728 ok(!strcmp(bufA, "Jan"), "got %s\n", bufA);
729
730 retA = p_strftime(bufA, 256, "%B", gmt_tm);
731 ok(retA == 7, "expected 7, got %ld\n", retA);
732 ok(!strcmp(bufA, "January"), "got %s\n", bufA);
733
734 retA = p_strftime(bufA, 256, "%d", gmt_tm);
735 ok(retA == 2, "expected 2, got %ld\n", retA);
736 ok(!strcmp(bufA, "01"), "got %s\n", bufA);
737
738 retA = p_strftime(bufA, 256, "%#d", gmt_tm);
739 ok(retA == 1, "expected 1, got %ld\n", retA);
740 ok(!strcmp(bufA, "1"), "got %s\n", bufA);
741
742 retA = p_strftime(bufA, 256, "%H", gmt_tm);
743 ok(retA == 2, "expected 2, got %ld\n", retA);
744 ok(!strcmp(bufA, "00"), "got %s\n", bufA);
745
746 retA = p_strftime(bufA, 256, "%I", gmt_tm);
747 ok(retA == 2, "expected 2, got %ld\n", retA);
748 ok(!strcmp(bufA, "12"), "got %s\n", bufA);
749
750 retA = p_strftime(bufA, 256, "%j", gmt_tm);
751 ok(retA == 3, "expected 3, got %ld\n", retA);
752 ok(!strcmp(bufA, "001"), "got %s\n", bufA);
753
754 retA = p_strftime(bufA, 256, "%m", gmt_tm);
755 ok(retA == 2, "expected 2, got %ld\n", retA);
756 ok(!strcmp(bufA, "01"), "got %s\n", bufA);
757
758 retA = p_strftime(bufA, 256, "%#M", gmt_tm);
759 ok(retA == 1, "expected 1, got %ld\n", retA);
760 ok(!strcmp(bufA, "0"), "got %s\n", bufA);
761
762 retA = p_strftime(bufA, 256, "%p", gmt_tm);
763 ok(retA == 2, "expected 2, got %ld\n", retA);
764 ok(!strcmp(bufA, "AM"), "got %s\n", bufA);
765
766 retA = p_strftime(bufA, 256, "%U", gmt_tm);
767 ok(retA == 2, "expected 2, got %ld\n", retA);
768 ok(!strcmp(bufA, "00"), "got %s\n", bufA);
769
770 retA = p_strftime(bufA, 256, "%W", gmt_tm);
771 ok(retA == 2, "expected 2, got %ld\n", retA);
772 ok(!strcmp(bufA, "00"), "got %s\n", bufA);
773
774 gmt_tm->tm_wday = 0;
775 retA = p_strftime(bufA, 256, "%U", gmt_tm);
776 ok(retA == 2, "expected 2, got %ld\n", retA);
777 ok(!strcmp(bufA, "01"), "got %s\n", bufA);
778
779 retA = p_strftime(bufA, 256, "%W", gmt_tm);
780 ok(retA == 2, "expected 2, got %ld\n", retA);
781 ok(!strcmp(bufA, "00"), "got %s\n", bufA);
782
783 gmt_tm->tm_yday = 365;
784 retA = p_strftime(bufA, 256, "%U", gmt_tm);
785 ok(retA == 2, "expected 2, got %ld\n", retA);
786 ok(!strcmp(bufA, "53"), "got %s\n", bufA);
787
788 retA = p_strftime(bufA, 256, "%W", gmt_tm);
789 ok(retA == 2, "expected 2, got %ld\n", retA);
790 ok(!strcmp(bufA, "52"), "got %s\n", bufA);
791
792 gmt_tm->tm_mon = 1;
793 gmt_tm->tm_mday = 30;
794 retA = p_strftime(bufA, 256, "%c", gmt_tm);
795 todo_wine {
796 ok(retA == 17, "expected 17, got %ld\n", retA);
797 ok(!strcmp(bufA, "02/30/70 00:00:00"), "got %s\n", bufA);
798 }
799
800 if(!setlocale(LC_ALL, "Japanese_Japan.932")) {
801 win_skip("Japanese_Japan.932 locale not available\n");
802 return;
803 }
804
805 /* test with multibyte character */
806 retA = p_strftime(bufA, 256, "\x82%c", gmt_tm);
807 ok(retA == 3, "expected 3, got %ld\n", retA);
808 ok(!strcmp(bufA, "\x82%c"), "got %s\n", bufA);
809}
810
811static void test_asctime(void)
812{
813 struct tm* gmt_tm;
814 time_t gmt;
815 char *ret;
816
817 if(!p_asctime || !p_gmtime)
818 {
819 win_skip("asctime or gmtime is not available\n");
820 return;
821 }
822
823 gmt = 0;
824 gmt_tm = p_gmtime(&gmt);
825 ret = p_asctime(gmt_tm);
826 ok(!strcmp(ret, "Thu Jan 01 00:00:00 1970\n"), "asctime returned %s\n", ret);
827
828 gmt = 312433121;
829 gmt_tm = p_gmtime(&gmt);
830 ret = p_asctime(gmt_tm);
831 ok(!strcmp(ret, "Mon Nov 26 02:58:41 1979\n"), "asctime returned %s\n", ret);
832
833 /* Week day is only checked if it's in 0..6 range */
834 gmt_tm->tm_wday = 3;
835 ret = p_asctime(gmt_tm);
836 ok(!strcmp(ret, "Wed Nov 26 02:58:41 1979\n"), "asctime returned %s\n", ret);
837
838 errno = 0xdeadbeef;
839 gmt_tm->tm_wday = 7;
840 ret = p_asctime(gmt_tm);
841 ok(!ret || broken(!ret[0]), "asctime returned %s\n", ret);
842 ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
843
844 /* Year day is ignored */
845 gmt_tm->tm_wday = 3;
846 gmt_tm->tm_yday = 1300;
847 ret = p_asctime(gmt_tm);
848 ok(!strcmp(ret, "Wed Nov 26 02:58:41 1979\n"), "asctime returned %s\n", ret);
849
850 /* Dates that can't be displayed using 26 characters are broken */
851 gmt_tm->tm_mday = 28;
852 gmt_tm->tm_year = 8100;
853 ret = p_asctime(gmt_tm);
854 ok(!strcmp(ret, "Wed Nov 28 02:58:41 :000\n"), "asctime returned %s\n", ret);
855
856 gmt_tm->tm_year = 264100;
857 ret = p_asctime(gmt_tm);
858 ok(!strcmp(ret, "Wed Nov 28 02:58:41 :000\n"), "asctime returned %s\n", ret);
859
860 /* asctime works from year 1900 */
861 errno = 0xdeadbeef;
862 gmt_tm->tm_year = -1;
863 ret = p_asctime(gmt_tm);
864 ok(!ret || broken(!strcmp(ret, "Wed Nov 28 02:58:41 190/\n")), "asctime returned %s\n", ret);
865 ok(errno==EINVAL || broken(errno == 0xdeadbeef), "errno = %d\n", errno);
866
867 errno = 0xdeadbeef;
868 gmt_tm->tm_mon = 1;
869 gmt_tm->tm_mday = 30;
870 gmt_tm->tm_year = 79;
871 ret = p_asctime(gmt_tm);
872 ok(!ret || broken(!strcmp(ret, "Wed Feb 30 02:58:41 1979\n")), "asctime returned %s\n", ret);
873 ok(errno==EINVAL || broken(errno==0xdeadbeef), "errno = %d\n", errno);
874}
875
876static void test__tzset(void)
877{
878 char TZ_env[256];
879 int ret;
880
882 skip("__p__daylight, __p__timezone or __p__dstbias is not available\n");
883 return;
884 }
885
886 if (p__dstbias) {
887 ret = *p__dstbias();
888 ok(ret == -3600, "*__dstbias() = %d\n", ret);
889 ret = *p___p__dstbias();
890 ok(ret == -3600, "*__p__dstbias() = %d\n", ret);
891 }
892 else
893 win_skip("__dstbias() is not available.\n");
894
895 _snprintf(TZ_env,255,"TZ=%s",(getenv("TZ")?getenv("TZ"):""));
896
897 ret = *p___p__daylight();
898 ok(ret == 1, "*__p__daylight() = %d\n", ret);
899 ret = *p___p__timezone();
900 ok(ret == 28800, "*__p__timezone() = %d\n", ret);
901 ret = *p___p__dstbias();
902 ok(ret == -3600, "*__p__dstbias() = %d\n", ret);
903
904 _putenv("TZ=xxx+1yyy");
905 _tzset();
906 ret = *p___p__daylight();
907 ok(ret == 121, "*__p__daylight() = %d\n", ret);
908 ret = *p___p__timezone();
909 ok(ret == 3600, "*__p__timezone() = %d\n", ret);
910 ret = *p___p__dstbias();
911 ok(ret == -3600, "*__p__dstbias() = %d\n", ret);
912
913 *p___p__dstbias() = 0;
914 _putenv("TZ=xxx+1:3:5zzz");
915 _tzset();
916 ret = *p___p__daylight();
917 ok(ret == 122, "*__p__daylight() = %d\n", ret);
918 ret = *p___p__timezone();
919 ok(ret == 3785, "*__p__timezone() = %d\n", ret);
920 ret = *p___p__dstbias();
921 ok(ret == 0, "*__p__dstbias() = %d\n", ret);
922
923 _putenv(TZ_env);
924}
925
927{
928 init();
929
930 test__tzset();
932 test_ctime();
933 test_gmtime();
934 test_mktime();
936 test_strdate();
937 test_strtime();
943 test_asctime();
944}
#define broken(x)
Definition: _sntprintf.h:21
#define EINVAL
Definition: acclib.h:90
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ERANGE
Definition: acclib.h:92
#define EBADF
Definition: acclib.h:82
#define __cdecl
Definition: accygwin.h:79
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
long __time32_t
Definition: crtdefs.h:379
int errno_t
Definition: crtdefs.h:374
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define GetProcAddress(x, y)
Definition: compat.h:753
#define WideCharToMultiByte
Definition: compat.h:111
static DOUBLE local_time(DOUBLE time, DateInstance *date)
Definition: date.c:351
static DOUBLE day(DOUBLE time)
Definition: date.c:117
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
DWORD WINAPI GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
Definition: timezone.c:262
static const WCHAR month[12][4]
Definition: session.c:2150
__kernel_time_t time_t
Definition: linux.h:252
unsigned long DWORD
Definition: ntddk_ex.h:95
time_t now
Definition: finger.c:65
BOOLEAN valid
GLuint start
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLuint res
Definition: glext.h:9613
GLuint buffer
Definition: glext.h:5915
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
GLuint64EXT * result
Definition: glext.h:11304
#define LC_ALL
Definition: locale.h:17
#define LC_TIME
Definition: locale.h:22
_Check_return_ _CRTIMP int __cdecl swscanf(_In_z_ const wchar_t *_Src, _In_z_ _Scanf_format_string_ const wchar_t *_Format,...)
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
_Check_return_ _CRTIMP int __cdecl putenv(_In_z_ const char *_EnvString)
_Check_return_ _CRTIMP int __cdecl _putenv(_In_z_ const char *_EnvString)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
__u16 ctime
Definition: mkdosfs.c:4
__u16 date
Definition: mkdosfs.c:8
__u16 time
Definition: mkdosfs.c:8
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143
BOOL expected
Definition: store.c:2063
#define SECSPERMIN
Definition: time.c:36
#define todo_wine
Definition: custom.c:79
static void test_daylight(void)
Definition: time.c:568
static void test_localtime32_s(void)
Definition: time.c:452
#define SECSPERDAY
Definition: time.c:33
static __time32_t *static __time64_t *static int *__cdecl * p__daylight(void)
static void test_mktime(void)
Definition: time.c:194
static void init(void)
Definition: time.c:56
static void test_strtime(void)
Definition: time.c:387
#define _MAX__TIME64_T
Definition: time.c:31
static void test_localtime(void)
Definition: time.c:305
static void test__tzset(void)
Definition: time.c:876
#define SECSPERHOUR
Definition: time.c:34
static void test_strdate(void)
Definition: time.c:352
static long *__cdecl * p___p__timezone(void)
static void test_localtime64_s(void)
Definition: time.c:503
static __time32_t *static size_t
Definition: time.c:43
static void test_gmtime(void)
Definition: time.c:98
static long *__cdecl * p___p__dstbias(void)
static struct tm *__cdecl * p_gmtime(time_t *)
static void test_strftime(void)
Definition: time.c:589
static long *__cdecl * p__dstbias(void)
static void test_ctime(void)
Definition: time.c:91
static int *__cdecl * p___p__daylight(void)
static void test_wstrdate(void)
Definition: time.c:424
static int get_test_year(time_t *start)
Definition: time.c:78
static void test_wstrtime(void)
Definition: time.c:438
static void test_asctime(void)
Definition: time.c:811
static const char const struct tm *static const wchar_t const struct tm *static char *__cdecl * p_asctime(const struct tm *)
static struct tm *__cdecl * p_gmtime32(__time32_t *)
#define err(...)
#define errno
Definition: errno.h:18
_CRTIMP char *__cdecl _strtime(_Out_writes_z_(9) char *_Buffer)
_CRTIMP time_t __cdecl mktime(struct tm *_Tm)
Definition: time.h:418
_CRTIMP wchar_t *__cdecl _wstrtime(_Out_writes_z_(9) wchar_t *_Buffer)
_CRTIMP char *__cdecl _strdate(_Out_writes_z_(9) char *_Buffer)
_CRTIMP wchar_t *__cdecl _wstrdate(_Out_writes_z_(9) wchar_t *_Buffer)
_CRTIMP void __cdecl _tzset(void)
Definition: timezone.c:92
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
Definition: time.h:416
#define win_skip
Definition: test.h:160
#define memset(x, y, z)
Definition: compat.h:39
WCHAR StandardName[32]
Definition: winbase.h:1207
Definition: send.c:48
Definition: time.h:68
int tm_mon
Definition: time.h:73
int tm_year
Definition: time.h:74
int tm_hour
Definition: time.h:71
int tm_sec
Definition: time.h:69
int tm_isdst
Definition: time.h:77
int tm_yday
Definition: time.h:76
int tm_mday
Definition: time.h:72
int tm_min
Definition: time.h:70
int tm_wday
Definition: time.h:75
#define setlocale(n, s)
Definition: locale.h:46
int ret
#define TIME_ZONE_ID_INVALID
Definition: winbase.h:286
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _snprintf
Definition: xmlstorage.h:200