From b47930c30149d90b0ed43c489a0e73e0bb1675a3 Mon Sep 17 00:00:00 2001 From: Emil Martinec Date: Sun, 1 Aug 2010 14:47:31 -0500 Subject: [PATCH] Timing for DCB. --- rtengine/mytime.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rtengine/mytime.h b/rtengine/mytime.h index 13ab8400a..858c78169 100644 --- a/rtengine/mytime.h +++ b/rtengine/mytime.h @@ -33,12 +33,22 @@ class MyTime { #ifndef WIN32 timespec t; #else - DWORD t; + LONGLONG t; + LONGLONG baseFrequency; + MyTime(){ + LARGE_INTEGER ulf; + QueryPerformanceFrequency(&ulf); + baseFrequency = ulf.QuadPart; + QueryPerformanceCounter(&ulf); + t = ulf.QuadPart; + } #endif void set () { #ifdef WIN32 - t = GetTickCount (); + LARGE_INTEGER ulf; + QueryPerformanceCounter(&ulf); + t = ulf.QuadPart; #elif defined __APPLE__ struct timeval tv; gettimeofday(&tv, NULL); @@ -53,7 +63,7 @@ class MyTime { #ifndef WIN32 return (t.tv_sec-a.t.tv_sec)*1000000 + (t.tv_nsec-a.t.tv_nsec)/1000; #else - return (t - a.t)*1000; + return (t - a.t)*1000/(baseFrequency/1000); #endif } };