diff options
-rw-r--r-- | ev_win32.c | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -133,22 +133,21 @@ fail: #undef pipe #define pipe(filedes) ev_pipe (filedes) - -static int -ev_gettimeofday (struct timeval *tv, struct timezone *tz) + +#define EV_HAVE_EV_TIME 1 +ev_tstamp +ev_time (void) { - struct _timeb tb; - - _ftime (&tb); + FILETIME ft; + ULARGE_INTEGER ui; - tv->tv_sec = (long)tb.time; - tv->tv_usec = ((long)tb.millitm) * 1000; + GetSystemTimeAsFileTime (&ft); + ui.u.LowPart = ft.dwLowDateTime; + ui.u.HighPart = ft.dwHighDateTime; - return 0; + /* msvc cannot convert ulonglong to double... yes, it is that sucky */ + return (__int64)(ui.QuadPart - 116444736000000000) * 1e-7; } -#undef gettimeofday -#define gettimeofday(tv,tz) ev_gettimeofday (tv, tz) - #endif |