(M68*:*:R3V[567]*:*): Use uppercase 'M'.
[glibc.git] / time / test-tz.c
blob2e1432cf11419f8007c695ad4a83847a083fecf0
1 #include <stdlib.h>
2 #include <time.h>
3 #include <string.h>
4 #include <stdio.h>
6 struct {
7 const char * env;
8 time_t expected;
9 } tests[] = {
10 {"TZ=MST", 832935315},
11 {"TZ=", 832910115},
12 {"TZ=:UTC", 832910115},
13 {"TZ=UTC", 832910115},
14 /* PROBLEM ahead. I fear the tzset code is somehow broken. */
15 /* {"TZ=UTC0", 832910115}*/
19 int
20 main(int argc, char ** argv)
22 int errors = 0;
23 struct tm tm;
24 time_t t;
25 unsigned int i;
27 memset (&tm, 0, sizeof (tm));
28 tm.tm_isdst = 0;
29 tm.tm_year = 96; /* years since 1900 */
30 tm.tm_mon = 4;
31 tm.tm_mday = 24;
32 tm.tm_hour = 3;
33 tm.tm_min = 55;
34 tm.tm_sec = 15;
36 for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
38 putenv (tests[i].env);
39 tzset ();
40 t = mktime(&tm);
41 if (t != tests[i].expected)
43 printf ("%s: flunked test %u (expected %lu, got %lu)\n",
44 argv[0], i, (long) tests[i].expected, (long) t);
45 ++errors;
48 if (errors == 0)
50 puts ("No errors.");
51 exit (EXIT_SUCCESS);
53 else
55 printf ("%d errors.\n", errors);
56 exit (EXIT_FAILURE);