1 /* Test program for mktime bugs with out-of-range tm_sec values. */
9 { .tm_sec
= -1, .tm_mday
= 1, .tm_year
= 104 },
10 { .tm_sec
= 65, .tm_min
= 59, .tm_hour
= 23, .tm_mday
= 31,
11 .tm_mon
= 11, .tm_year
= 101 }
13 struct tm expected
[] =
15 { .tm_sec
= 59, .tm_min
= 59, .tm_hour
= 23, .tm_mday
= 31,
16 .tm_mon
= 11, .tm_year
= 103, .tm_wday
= 3, .tm_yday
= 364 },
17 { .tm_sec
= 5, .tm_mday
= 1, .tm_year
= 102, .tm_wday
= 2 }
23 setenv ("TZ", "UTC", 1);
25 for (i
= 0; i
< sizeof (tests
) / sizeof (tests
[0]); ++i
)
27 if (mktime (&tests
[i
]) < 0)
29 printf ("mktime %d failed\n", i
);
33 if (tests[i].name != expected[i].name) \
35 printf ("test %d " #name " got %d expected %d\n", \
36 i, tests[i].name, expected[i].name); \