Fix Windows: use sys/time.h for gettimeofday, remove custom implementation

This commit is contained in:
Evgeny committed 2026-02-15 12:57:53 +03:00
1 parent 4403c46788
commit f510d78bb5
3 files changed
+12 -59

No files matched your search

+2 -18
View File
@@ -39,24 +39,8 @@
#define POLLPRI 0x0002
#endif
// gettimeofday for Windows (timezone already defined in time.h)
// Note: MSYS2 already has gettimeofday in sys/time.h, so we skip it here
#if !defined(HAVE_GETTIMEOFDAY) && !defined(__MINGW32__)
static inline int gettimeofday(struct timeval *tv, void *tz) {
(void)tz;
if (tv) {
FILETIME ft;
ULARGE_INTEGER ull;
GetSystemTimeAsFileTime(&ft);
ull.LowPart = ft.dwLowDateTime;
ull.HighPart = ft.dwHighDateTime;
// Convert from 100-nanosecond intervals since 1601 to Unix epoch
tv->tv_sec = (long)(ull.QuadPart / 10000000ULL - 11644473600ULL);
tv->tv_usec = (long)((ull.QuadPart % 10000000ULL) / 10);
}
return 0;
}
#endif
// gettimeofday for Windows (use system implementation if available)
#include <sys/time.h>
// Pipe creation for Windows
static inline int platform_pipe(int pipefd[2]) {