diff --git a/src/common/sysutils.cpp b/src/common/sysutils.cpp index 0a13b7e..6f36ae0 100644 --- a/src/common/sysutils.cpp +++ b/src/common/sysutils.cpp @@ -150,6 +150,22 @@ system_is_multiprocessor() return mp; } +#ifdef _WIN32 + +void gettimeofday(struct timeval *tv, void *tz) +{ + union { + long long ns100; + FILETIME ft; + } now; + + ::GetSystemTimeAsFileTime(&now.ft); + tv->tv_usec = (long)((now.ns100 / 10LL) % 1000000LL); + tv->tv_sec = (long)((now.ns100 - 116444736000000000LL) / 10000000LL); +} + +#endif + void system_specific_initialise() { #if defined HAVE_IPP diff --git a/src/common/sysutils.h b/src/common/sysutils.h index c59e1bf..9bcdd9a 100644 --- a/src/common/sysutils.h +++ b/src/common/sysutils.h @@ -99,6 +99,11 @@ extern bool system_is_multiprocessor(); extern void system_specific_initialise(); extern void system_specific_application_initialise(); +#ifdef _WIN32 +struct timeval { long tv_sec; long tv_usec; }; +void gettimeofday(struct timeval *p, void *tz); +#endif // _WIN32 + } // end namespace // The following should be functions in the RubberBand namespace, really