summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ev_win32.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/ev_win32.c b/ev_win32.c
index 61bff50..727c686 100644
--- a/ev_win32.c
+++ b/ev_win32.c
@@ -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