linuxthreads: add back signal.h
[uclibc-ng.git] / test / time / bug-asctime.c
blob149e4e0a28782bffe8b0b7f48f8b1e1cbcf87e91
1 /* Note: we disable this on uClibc because we dont bother
2 * verifying if the year is sane ... we just return ????
3 * for the year value ...
4 */
6 #include <errno.h>
7 #include <limits.h>
8 #include <stdio.h>
9 #include <time.h>
12 static int
13 do_test (void)
15 int result = 0;
16 time_t t = time (NULL);
17 struct tm *tp = localtime (&t);
18 tp->tm_year = INT_MAX;
19 errno = 0;
20 char *s = asctime (tp);
21 if (s != NULL || errno != EOVERFLOW)
23 printf ("asctime did not fail correctly: s=%p, wanted %p; errno=%i, wanted %i\n",
24 s, NULL, errno, EOVERFLOW);
25 result = 1;
27 char buf[1000];
28 errno = 0;
29 s = asctime_r (tp, buf);
30 if (s != NULL || errno != EOVERFLOW)
32 printf ("asctime_r did not fail correctly: s=%p, wanted %p; errno=%i, wanted %i\n",
33 s, NULL, errno, EOVERFLOW);
34 result = 1;
36 return result;
39 #define TEST_FUNCTION do_test ()
40 #include "../test-skeleton.c"