1 /* vi: set sw=4 ts=4: */
2 /* testcase for ctime(3) with large time
3 * Copyright (C) 2010 David A Ramos <daramos@gustav.stanford.edu>
4 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
12 #define MAX_POSITIVE(type) (~0 & ~((type) 1 << (sizeof(type)*8 - 1)))
14 int do_test(int argc, char **argv) {
15 char *correct = 0, *s;
18 /* need a very high positive number (e.g., max - 1024) */
19 time_t test = MAX_POSITIVE(time_t) - 1024;
21 s = asctime(localtime(&test));
24 // copy static buffer to heap
25 correct = malloc(strlen(s)+1);
31 printf("ANSI:\t%suClibc:\t%s", correct, s);
33 if (s != correct && strcmp(correct, s))
34 status = EXIT_FAILURE;
36 status = EXIT_SUCCESS;
44 #include <test-skeleton.c>