diff options
author | Ron Yorston <rmy@pobox.com> | 2024-08-14 10:20:46 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-08-14 10:26:41 +0100 |
commit | 6e82b6c6a0b55fdc156f7065d177e530e417520c (patch) | |
tree | 2be359a20c81904f3fa04ef42557c685fc7ae393 | |
parent | 770bad1fe3c369da32b53d790a26f82c012666e7 (diff) | |
download | busybox-w32-6e82b6c6a0b55fdc156f7065d177e530e417520c.tar.gz busybox-w32-6e82b6c6a0b55fdc156f7065d177e530e417520c.tar.bz2 busybox-w32-6e82b6c6a0b55fdc156f7065d177e530e417520c.zip |
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)
-rw-r--r-- | win32/mingw.c | 2 |
1 files changed, 1 insertions, 1 deletions
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 | |||
1936 | } | 1936 | } |
1937 | else if ( t[1] == 's' ) { | 1937 | else if ( t[1] == 's' ) { |
1938 | tm2 = *tm; | 1938 | tm2 = *tm; |
1939 | sprintf(buffer, "%d", (int)mktime(&tm2)); | 1939 | sprintf(buffer, "%"LL_FMT"d", (long long)mktime(&tm2)); |
1940 | replace = buffer; | 1940 | replace = buffer; |
1941 | } | 1941 | } |
1942 | else if ( t[1] == 'T' ) { | 1942 | else if ( t[1] == 'T' ) { |