From 6e82b6c6a0b55fdc156f7065d177e530e417520c Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Wed, 14 Aug 2024 10:20:46 +0100 Subject: win32: fix strftime(3) '%s' format The '%s' format of our strftime(3) wrapper (display number of seconds since the Unix epoch) returned incorrect results on 64-bit systems for times more than 2^31 seconds after the epoch. Use the correct format. Adds 16 bytes. (GitHub issue #446) --- win32/mingw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32/mingw.c b/win32/mingw.c index a7540d220..dfe38734a 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -1936,7 +1936,7 @@ size_t mingw_strftime(char *buf, size_t max, const char *format, const struct tm } else if ( t[1] == 's' ) { tm2 = *tm; - sprintf(buffer, "%d", (int)mktime(&tm2)); + sprintf(buffer, "%"LL_FMT"d", (long long)mktime(&tm2)); replace = buffer; } else if ( t[1] == 'T' ) { -- cgit v1.2.3-55-g6feb