aboutsummaryrefslogtreecommitdiff
path: root/miscutils/ts.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2024-08-14 12:52:56 +0100
committerRon Yorston <rmy@pobox.com>2024-08-14 13:10:19 +0100
commit6481bb22b5e6d60909d09cf6179412c4f34b9b3c (patch)
tree63265600738004f99ad1afcae54d209405bc604d /miscutils/ts.c
parent6e82b6c6a0b55fdc156f7065d177e530e417520c (diff)
downloadbusybox-w32-6481bb22b5e6d60909d09cf6179412c4f34b9b3c.tar.gz
busybox-w32-6481bb22b5e6d60909d09cf6179412c4f34b9b3c.tar.bz2
busybox-w32-6481bb22b5e6d60909d09cf6179412c4f34b9b3c.zip
win32: use 64-bit time on 32-bit platforms
To avoid problems with dates in 2038 and beyond use 64-bit time values on 32-bit platforms. - Mostly this just requires a few preprocessor macros to choose the appropriate functions, structs and typedefs. - We have our own implementations of nanosleep(), clock_gettime() and clock_settime(). Omit the Windows include file that declares them. - Apply the hack for struct timeval in the 'ts' applet on 32-bit. Adds 1624 bytes on 32-bit, none on 64-bit. (GitHub issue #446)
Diffstat (limited to '')
-rw-r--r--miscutils/ts.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/miscutils/ts.c b/miscutils/ts.c
index f5e727eb5..fb669b858 100644
--- a/miscutils/ts.c
+++ b/miscutils/ts.c
@@ -25,7 +25,7 @@ int ts_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
25int ts_main(int argc UNUSED_PARAM, char **argv) 25int ts_main(int argc UNUSED_PARAM, char **argv)
26{ 26{
27 struct timeval base; 27 struct timeval base;
28#if ENABLE_PLATFORM_MINGW32 && !defined(_USE_32BIT_TIME_T) 28#if ENABLE_PLATFORM_MINGW32
29 time_t t; 29 time_t t;
30#endif 30#endif
31 unsigned opt; 31 unsigned opt;
@@ -76,7 +76,7 @@ int ts_main(int argc UNUSED_PARAM, char **argv)
76 if (opt & 1) /* -i */ 76 if (opt & 1) /* -i */
77 base = ts1; 77 base = ts1;
78 } 78 }
79#if ENABLE_PLATFORM_MINGW32 && !defined(_USE_32BIT_TIME_T) 79#if ENABLE_PLATFORM_MINGW32
80 t = ts.tv_sec; 80 t = ts.tv_sec;
81 localtime_r(&t, &tm_time); 81 localtime_r(&t, &tm_time);
82#else 82#else