From a7a116970b4342d8a24432144cc09a80be4ad2ca Mon Sep 17 00:00:00 2001 From: Nick Banks Date: Wed, 9 Nov 2016 16:41:22 -0800 Subject: [PATCH] Hacks to get windows time working with POSIX APIs, so we can get rid of appveyor build warning. (#963) --- examples/platforms/posix/platform-posix.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/platforms/posix/platform-posix.h b/examples/platforms/posix/platform-posix.h index 2958914bb..8f12421c7 100644 --- a/examples/platforms/posix/platform-posix.h +++ b/examples/platforms/posix/platform-posix.h @@ -48,17 +48,19 @@ #include #define POLL WSAPoll #define ssize_t int +#include +#define localtime _localtime32 // In user mode, define some Linux functions __forceinline int gettimeofday(struct timeval *tv, struct timezone *tz) { (void)tz; - tv->tv_sec = (long)GetTickCount(); // Generally 0 at the start of the application + tv->tv_sec = _time32(NULL); tv->tv_usec = 0; return 0; } __forceinline void timersub(struct timeval *a, struct timeval *b, struct timeval *res) { - res->tv_sec = a->tv_sec - b->tv_sec; + res->tv_sec = (long)_difftime32(a->tv_sec, b->tv_sec); res->tv_usec = 0; } #else