From d21112170180849d6d7acfbd28b5bc22f601fa27 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Thu, 14 Jul 2022 17:49:22 +0100 Subject: [PATCH] Ah, this was still in use in Scavenger. It can stay for now --- src/common/sysutils.cpp | 16 ++++++++++++++++ src/common/sysutils.h | 5 +++++ 2 files changed, 21 insertions(+) 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