31#define _MAX__TIME64_T (((__time64_t)0x00000007 << 32) | 0x93406FFF)
33#define SECSPERDAY 86400
34#define SECSPERHOUR 3600
96 ok(
ret ==
NULL,
"expected ctime to return NULL, got %s\n",
ret);
101 struct tm* gmt_tm, gmt_tm_s;
105 win_skip(
"Skipping _gmtime32 tests\n");
110 ok(gmt_tm ==
NULL,
"gmt_tm != NULL\n");
119 ok(0,
"_gmtime32() failed\n");
126 "Wrong date:Year %4d mon %2d yday %3d mday %2d wday %1d hour%2d min %2d sec %2d dst %2d\n",
131 win_skip(
"Skipping _mkgmtime32 tests\n");
136 gmt = p_mkgmtime32(gmt_tm);
137 ok(gmt ==
valid,
"gmt = %u\n", gmt);
143 gmt = p_mkgmtime32(gmt_tm);
144 ok(gmt ==
valid,
"gmt = %u\n", gmt);
150 gmt = p_mkgmtime32(gmt_tm);
151 ok(gmt ==
valid,
"gmt = %u\n", gmt);
155 gmt =
valid = 173921;
158 ok(0,
"_gmtime32() failed\n");
163 gmt = p_mkgmtime32(gmt_tm);
164 ok(gmt ==
valid,
"gmt = %u\n", gmt);
169 gmt = p_mkgmtime32(gmt_tm);
170 ok(gmt ==
valid,
"gmt = %u\n", gmt);
173 win_skip(
"Skipping _gmtime32_s tests\n");
179 err = p_gmtime32_s(
NULL, &gmt);
185 err = p_gmtime32_s(&gmt_tm_s, &gmt);
187 "tm_year = %d, tm_sec = %d\n", gmt_tm_s.
tm_year, gmt_tm_s.
tm_sec);
198 struct tm my_tm, sav_tm;
210 trace(
"bias %d std %d dst %d zone %s\n",
237 ok(
local_time ==
ref,
"Unnormalized mktime returned %u, expected %u\n",
242 "mktime returned %2d-%02d-%02d %02d:%02d expected %2d-%02d-%02d %02d:%02d\n",
251 ok(
local_time ==
ref,
"Unnormalized mktime returned %u, expected %u\n",
256 "mktime returned %2d-%02d-%02d %02d:%02d expected %2d-%02d-%02d %02d:%02d\n",
265 ok(
local_time ==
ref,
"Unnormalized mktime returned %u, expected %u\n",
270 "mktime returned %2d-%02d-%02d %02d:%02d expected %2d-%02d-%02d %02d:%02d\n",
279 ok(
local_time ==
ref,
"Unnormalized mktime returned %u, expected %u\n",
284 "mktime returned %2d-%02d-%02d %02d:%02d expected %2d-%02d-%02d %02d:%02d\n",
300 nulltime =
mktime(&my_tm);
301 ok(nulltime ==
ref,
"mktime returned 0x%08x\n",(
DWORD)nulltime);
314 int is_leap = !(year % 4) && ((year % 100) || !((year + 300) % 400));
324 "Wrong date:Year %d mon %d yday %d mday %d wday %d hour %d min %d sec %d dst %d\n",
334 "Wrong date:Year %d mon %d yday %d mday %d wday %d hour %d min %d sec %d dst %d\n",
347 "Wrong date:Year %d mon %d yday %d mday %d wday %d hour %d min %d sec %d dst %d\n",
361 ok(
len == 8,
"Wrong length: returned %d, should be 8\n",
len);
363 ok(
count == 3,
"Wrong format: count = %d, should be 3\n",
count);
366 win_skip(
"Skipping _strdate_s tests\n");
380 ok(
date[0] ==
'\0',
"date[0] != '\\0'\n");
381 ok(
date[1] ==
'x',
"date[1] != 'x'\n");
390 int hour, minute, second,
count,
len;
396 ok(
len == 8,
"Wrong length: returned %d, should be 8\n",
len);
398 ok(
count == 3,
"Wrong format: count = %d, should be 3\n",
count);
401 win_skip(
"Skipping _strtime_s tests\n");
418 ok(
time[0] ==
'\0',
"time[0] != '\\0'\n");
428 wchar_t format[] = {
'%',
'0',
'2',
'd',
'/',
'%',
'0',
'2',
'd',
'/',
'%',
'0',
'2',
'd',0 };
433 ok(
len == 8,
"Wrong length: returned %d, should be 8\n",
len);
435 ok(
count == 3,
"Wrong format: count = %d, should be 3\n",
count);
441 int hour, minute, second,
count,
len;
442 wchar_t format[] = {
'%',
'0',
'2',
'd',
':',
'%',
'0',
'2',
'd',
':',
'%',
'0',
'2',
'd',0 };
447 ok(
len == 8,
"Wrong length: returned %d, should be 8\n",
len);
449 ok(
count == 3,
"Wrong format: count = %d, should be 3\n",
count);
458 if (!p_localtime32_s)
460 win_skip(
"Skipping _localtime32_s tests\n");
466 ok(
err ==
EINVAL,
"Expected _localtime32_s to return EINVAL, got %d\n",
err);
472 ok(
err ==
EINVAL,
"Expected _localtime32_s to return EINVAL, got %d\n",
err);
478 ok(
err ==
EINVAL,
"Expected _localtime32_s to return EINVAL, got %d\n",
err);
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,
492 ok(
err ==
EINVAL,
"Expected _localtime32_s to return EINVAL, got %d\n",
err);
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,
509 if (!p_localtime64_s)
511 win_skip(
"Skipping _localtime64_s tests\n");
517 ok(
err ==
EINVAL,
"Expected _localtime64_s to return EINVAL, got %d\n",
err);
523 ok(
err ==
EINVAL,
"Expected _localtime64_s to return EINVAL, got %d\n",
err);
529 ok(
err ==
EINVAL,
"Expected _localtime64_s to return EINVAL, got %d\n",
err);
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,
543 ok(
err ==
EINVAL,
"Expected _localtime64_s to return EINVAL, got %d\n",
err);
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,
557 ok(
err ==
EINVAL,
"Expected _localtime64_s to return EINVAL, got %d\n",
err);
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,
574 win_skip(
"__daylight() not available\n");
580 skip(
"__p__daylight not available\n");
586 ok(ret1 && ret1 == ret2,
"got %p\n", ret1);
591 static const wchar_t cW[] = {
'%',
'c',0 };
592 static const char expected[] =
"01/01/70 00:00:00";
595 char buf[256], bufA[256];
599 if (!p_strftime || !p_wcsftime || !
p_gmtime)
601 win_skip(
"strftime, wcsftime or gmtime is not available\n");
609 ok(gmt_tm !=
NULL,
"gmtime failed\n");
612 retA = p_strftime(bufA, 256,
"%C", gmt_tm);
613 ok(retA == 0,
"expected 0, got %ld\n", retA);
617 retA = p_strftime(bufA, 256,
"%D", gmt_tm);
618 ok(retA == 0,
"expected 0, got %ld\n", retA);
622 retA = p_strftime(bufA, 256,
"%e", gmt_tm);
623 ok(retA == 0,
"expected 0, got %ld\n", retA);
627 retA = p_strftime(bufA, 256,
"%F", gmt_tm);
628 ok(retA == 0,
"expected 0, got %ld\n", retA);
632 retA = p_strftime(bufA, 256,
"%h", gmt_tm);
633 ok(retA == 0,
"expected 0, got %ld\n", retA);
637 retA = p_strftime(bufA, 256,
"%n", gmt_tm);
638 ok(retA == 0,
"expected 0, got %ld\n", retA);
642 retA = p_strftime(bufA, 256,
"%R", gmt_tm);
643 ok(retA == 0,
"expected 0, got %ld\n", retA);
647 retA = p_strftime(bufA, 256,
"%t", gmt_tm);
648 ok(retA == 0,
"expected 0, got %ld\n", retA);
652 retA = p_strftime(bufA, 256,
"%T", gmt_tm);
653 ok(retA == 0,
"expected 0, got %ld\n", retA);
657 retA = p_strftime(bufA, 256,
"%u", gmt_tm);
658 ok(retA == 0,
"expected 0, got %ld\n", retA);
662 retA = p_strftime(
NULL, 0,
"copy", gmt_tm);
663 ok(retA == 0,
"expected 0, got %ld\n", retA);
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);
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);
675 retA = p_strftime(bufA, 2,
"copy", gmt_tm);
676 ok(retA == 0,
"expected 0, got %ld\n", retA);
681 retA = p_strftime(bufA, 256,
"a%e", gmt_tm);
682 ok(retA==0 ||
broken(retA==1),
"expected 0, got %ld\n", retA);
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);
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);
698 retA = p_strftime(bufA, 256,
"%c", gmt_tm);
699 ok(retA == 17,
"expected 17, got %ld\n", retA);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
794 retA = p_strftime(bufA, 256,
"%c", gmt_tm);
796 ok(retA == 17,
"expected 17, got %ld\n", retA);
797 ok(!
strcmp(bufA,
"02/30/70 00:00:00"),
"got %s\n", bufA);
801 win_skip(
"Japanese_Japan.932 locale not available\n");
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);
819 win_skip(
"asctime or gmtime is not available\n");
826 ok(!
strcmp(
ret,
"Thu Jan 01 00:00:00 1970\n"),
"asctime returned %s\n",
ret);
831 ok(!
strcmp(
ret,
"Mon Nov 26 02:58:41 1979\n"),
"asctime returned %s\n",
ret);
836 ok(!
strcmp(
ret,
"Wed Nov 26 02:58:41 1979\n"),
"asctime returned %s\n",
ret);
848 ok(!
strcmp(
ret,
"Wed Nov 26 02:58:41 1979\n"),
"asctime returned %s\n",
ret);
854 ok(!
strcmp(
ret,
"Wed Nov 28 02:58:41 :000\n"),
"asctime returned %s\n",
ret);
858 ok(!
strcmp(
ret,
"Wed Nov 28 02:58:41 :000\n"),
"asctime returned %s\n",
ret);
882 skip(
"__p__daylight, __p__timezone or __p__dstbias is not available\n");
888 ok(
ret == -3600,
"*__dstbias() = %d\n",
ret);
890 ok(
ret == -3600,
"*__p__dstbias() = %d\n",
ret);
893 win_skip(
"__dstbias() is not available.\n");
898 ok(
ret == 1,
"*__p__daylight() = %d\n",
ret);
900 ok(
ret == 28800,
"*__p__timezone() = %d\n",
ret);
902 ok(
ret == -3600,
"*__p__dstbias() = %d\n",
ret);
907 ok(
ret == 121,
"*__p__daylight() = %d\n",
ret);
909 ok(
ret == 3600,
"*__p__timezone() = %d\n",
ret);
911 ok(
ret == -3600,
"*__p__dstbias() = %d\n",
ret);
917 ok(
ret == 122,
"*__p__daylight() = %d\n",
ret);
919 ok(
ret == 3785,
"*__p__timezone() = %d\n",
ret);
921 ok(
ret == 0,
"*__p__dstbias() = %d\n",
ret);
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
#define GetProcAddress(x, y)
#define WideCharToMultiByte
static DOUBLE local_time(DOUBLE time, DateInstance *date)
static DOUBLE day(DOUBLE time)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
DWORD WINAPI GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
static const WCHAR month[12][4]
GLuint GLuint GLsizei count
GLenum GLuint GLenum GLsizei const GLchar * buf
_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)
static PEXPLICIT_ACCESSW *static HMODULE hmod
static void test_daylight(void)
static void test_localtime32_s(void)
static __time32_t *static __time64_t *static int *__cdecl * p__daylight(void)
static void test_mktime(void)
static void test_strtime(void)
static void test_localtime(void)
static void test__tzset(void)
static void test_strdate(void)
static long *__cdecl * p___p__timezone(void)
static void test_localtime64_s(void)
static __time32_t *static size_t
static void test_gmtime(void)
static long *__cdecl * p___p__dstbias(void)
static struct tm *__cdecl * p_gmtime(time_t *)
static void test_strftime(void)
static long *__cdecl * p__dstbias(void)
static void test_ctime(void)
static int *__cdecl * p___p__daylight(void)
static void test_wstrdate(void)
static int get_test_year(time_t *start)
static void test_wstrtime(void)
static void test_asctime(void)
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 *)
_CRTIMP char *__cdecl _strtime(_Out_writes_z_(9) char *_Buffer)
_CRTIMP time_t __cdecl mktime(struct tm *_Tm)
_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)
_CRTIMP struct tm *__cdecl localtime(const time_t *_Time)
#define TIME_ZONE_ID_INVALID