From 3467d6f282146d6e84d5d840d532fa6ec4536d64 Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Fri, 2 Aug 2024 21:54:08 +0200 Subject: Attempt to fix 2038 problem with MSVC --- crypto/compat/posix_win.c | 4 +++- include/compat/sys/time.h | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/crypto/compat/posix_win.c b/crypto/compat/posix_win.c index bb3e653..bed8c84 100644 --- a/crypto/compat/posix_win.c +++ b/crypto/compat/posix_win.c @@ -9,6 +9,8 @@ #define NO_REDEF_POSIX_FUNCTIONS +#include + #include #include @@ -306,7 +308,7 @@ int gettimeofday(struct timeval * tp, struct timezone * tzp) time = ((uint64_t)file_time.dwLowDateTime); time += ((uint64_t)file_time.dwHighDateTime) << 32; - tp->tv_sec = (long)((time - EPOCH) / 10000000L); + tp->tv_sec = (long long)((time - EPOCH) / 10000000L); tp->tv_usec = (long)(system_time.wMilliseconds * 1000); return 0; } diff --git a/include/compat/sys/time.h b/include/compat/sys/time.h index 76428c1..2448969 100644 --- a/include/compat/sys/time.h +++ b/include/compat/sys/time.h @@ -8,6 +8,15 @@ #ifdef _MSC_VER #include + +#define timeval libressl_timeval +#define gettimeofday libressl_gettimeofday + +struct timeval { + long long tv_sec; + long tv_usec; +}; + int gettimeofday(struct timeval *tp, void *tzp); #else #include_next -- cgit v1.2.3-55-g6feb