Updated to fedora-glibc-20080305T0857
[glibc.git] / time / bug-asctime.c
blob0b04b475a84d56265a319ab11e779b99206b848c
1 #include <errno.h>
2 #include <limits.h>
3 #include <stdio.h>
4 #include <time.h>
7 static int
8 do_test (void)
10 int result = 0;
11 time_t t = time (NULL);
12 struct tm *tp = localtime (&t);
13 tp->tm_year = INT_MAX;
14 errno = 0;
15 char *s = asctime (tp);
16 if (s != NULL || errno != EOVERFLOW)
18 puts ("asctime did not fail correctly");
19 result = 1;
21 char buf[1000];
22 errno = 0;
23 s = asctime_r (tp, buf);
24 if (s != NULL || errno != EOVERFLOW)
26 puts ("asctime_r did not fail correctly");
27 result = 1;
29 return result;
32 #define TEST_FUNCTION do_test ()
33 #include "../test-skeleton.c"