From 9ed13add011e41f76eb76624afa46e7a4da45b41 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Wed, 24 Jan 2024 16:13:54 -0600 Subject: [PATCH] Update test2038.c https://github.com/Hamlib/Hamlib/issues/1478 --- tests/test2038.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/test2038.c b/tests/test2038.c index 3145464d8..8d7fe70a4 100644 --- a/tests/test2038.c +++ b/tests/test2038.c @@ -6,28 +6,40 @@ Does fail when compiled with gcc -m32 -o 2038 2038.c #include #include -int main(void) +int test2038(void) { time_t x; + //printf("sizeof(time_t)=%d\n", (int)sizeof(time_t)); + x = (time_t)((1U << 31) - 1); + //printf("x=%lu\n", (unsigned long)x); char *s = ctime(&x); - //printf("%s", s); + //printf("%s\n", s); + //printf("x=%lu\n", (unsigned long)x); if (!strstr(s, "2038")) { return 1; } x += 1; s = ctime(&x); + //printf("x=%lu\n", (unsigned long)x); + //printf("%s\n", s); if (!strstr(s, "2038")) { return 1; } - //printf("%s", s); + //printf("x=%lu\n", (unsigned long)x); + //printf("%s\n", s); x += 1; s = ctime(&x); if (!strstr(s, "2038")) { return 1; } - //printf("%s", s); + //printf("%s\n", s); return 0; } + +int main(void) +{ + return test2038(); +}