diff options
author | Pierre Ossman <ossman@cendio.se> | 2015-11-09 15:27:54 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2015-11-09 15:27:54 +0100 |
commit | 9c181baf3c648e95a150c76eebd7ae5b5633c578 (patch) | |
tree | be46995a77ad207f380b35794b152aa40e796aa2 /common/rfb/Timer.cxx | |
parent | 07eec1b59bcc4c03c4b3f090be8458b8e4836555 (diff) | |
download | tigervnc-9c181baf3c648e95a150c76eebd7ae5b5633c578.tar.gz tigervnc-9c181baf3c648e95a150c76eebd7ae5b5633c578.zip |
Use mingw's gettimeofday()
mingw has a perfectly functional gettimeofday() so use that instead
of having multiple copies of our own version.
Diffstat (limited to 'common/rfb/Timer.cxx')
-rw-r--r-- | common/rfb/Timer.cxx | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/common/rfb/Timer.cxx b/common/rfb/Timer.cxx index 5f9c6f2f..676f24e1 100644 --- a/common/rfb/Timer.cxx +++ b/common/rfb/Timer.cxx @@ -19,11 +19,8 @@ // -=- Timer.cxx #include <stdio.h> -#ifdef WIN32 -#ifndef _WIN32_WCE -#include <sys/timeb.h> -#endif -#endif +#include <sys/time.h> + #include <rfb/Timer.h> #include <rfb/util.h> #include <rfb/LogWriter.h> @@ -40,39 +37,6 @@ static LogWriter vlog("Timer"); #endif -// Win32 does not provide gettimeofday, so we emulate it to simplify the -// Timer code. - -#ifdef _WIN32 -static void gettimeofday(struct timeval* tv, void*) -{ - LARGE_INTEGER counts, countsPerSec; - static double usecPerCount = 0.0; - - if (QueryPerformanceCounter(&counts)) { - if (usecPerCount == 0.0) { - QueryPerformanceFrequency(&countsPerSec); - usecPerCount = 1000000.0 / countsPerSec.QuadPart; - } - - LONGLONG usecs = (LONGLONG)(counts.QuadPart * usecPerCount); - tv->tv_usec = (long)(usecs % 1000000); - tv->tv_sec = (long)(usecs / 1000000); - - } else { -#ifndef _WIN32_WCE - struct timeb tb; - ftime(&tb); - tv->tv_sec = tb.time; - tv->tv_usec = tb.millitm * 1000; -#else - throw SystemException("QueryPerformanceCounter", GetLastError()); -#endif - } -} -#endif - - // Millisecond timeout processing helper functions inline static timeval addMillis(timeval inTime, int millis) { |