]> git.ipfire.org Git - thirdparty/glibc.git/blame - time/bug-asctime_r.c
y2038: Export __clock_gettime64 to be usable in other libraries
[thirdparty/glibc.git] / time / bug-asctime_r.c
CommitLineData
ce982312
UD
1#include <errno.h>
2#include <limits.h>
3#include <stdio.h>
4#include <time.h>
5
6
7static int
8do_test (void)
9{
10 int result = 0;
11 time_t t = time (NULL);
12 struct tm *tp = localtime (&t);
13 tp->tm_year = 10000 - 1900;
14 char buf[1000];
15 errno = 0;
3394d632 16 buf[26] = '\xff';
ce982312
UD
17 char *s = asctime_r (tp, buf);
18 if (s != NULL || errno != EOVERFLOW)
19 {
20 puts ("asctime_r did not fail correctly");
21 result = 1;
22 }
3394d632
UD
23 if (buf[26] != '\xff')
24 {
25 puts ("asctime_r overwrote 27th byte in buffer");
26 result = 1;
27 }
ce982312
UD
28 return result;
29}
30
31#define TEST_FUNCTION do_test ()
32#include "../test-skeleton.c"