Attempt to fix 2038 problem with MSVC

This commit is contained in:
Theo Buehler
2024-08-02 21:54:08 +02:00
committed by Brent Cook
parent 9a399d26a0
commit 3467d6f282
2 changed files with 12 additions and 1 deletions

View File

@@ -9,6 +9,8 @@
#define NO_REDEF_POSIX_FUNCTIONS
#include <sys/time.h>
#include <ws2tcpip.h>
#include <windows.h>
@@ -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;
}

View File

@@ -8,6 +8,15 @@
#ifdef _MSC_VER
#include <winsock2.h>
#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 <sys/time.h>