hppa: assume TLS everywhere
[glibc.git] / time / tst-strptime3.c
blobd53f51ee22443de55e84d84e0efdd1c0c5c6989f
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <time.h>
7 static int
8 do_test (void)
10 int result = 0;
11 struct tm tm;
13 memset (&tm, 0xaa, sizeof (tm));
15 /* Test we don't crash on uninitialized struct tm.
16 Some fields might contain bogus values until everything
17 needed is initialized, but we shouldn't crash. */
18 if (strptime ("2007", "%Y", &tm) == NULL
19 || strptime ("12", "%d", &tm) == NULL
20 || strptime ("Feb", "%b", &tm) == NULL
21 || strptime ("13", "%M", &tm) == NULL
22 || strptime ("21", "%S", &tm) == NULL
23 || strptime ("16", "%H", &tm) == NULL)
25 puts ("strptimes failed");
26 result = 1;
29 if (tm.tm_sec != 21 || tm.tm_min != 13 || tm.tm_hour != 16
30 || tm.tm_mday != 12 || tm.tm_mon != 1 || tm.tm_year != 107
31 || tm.tm_wday != 1 || tm.tm_yday != 42)
33 puts ("unexpected tm content");
34 result = 1;
37 if (strptime ("8", "%d", &tm) == NULL)
39 puts ("strptime failed");
40 result = 1;
43 if (tm.tm_sec != 21 || tm.tm_min != 13 || tm.tm_hour != 16
44 || tm.tm_mday != 8 || tm.tm_mon != 1 || tm.tm_year != 107
45 || tm.tm_wday != 4 || tm.tm_yday != 38)
47 puts ("unexpected tm content");
48 result = 1;
51 return result;
54 #define TEST_FUNCTION do_test ()
55 #include "../test-skeleton.c"