00001 #include <windows.h> 00002 #include <mmsystem.h> 00003 #include "timer.hpp" 00004 00005 00006 adr_u64 GetNow() { 00007 // get frequency of the performance counter 00008 LARGE_INTEGER frequency; 00009 if (QueryPerformanceFrequency(&frequency) && frequency.QuadPart != 0) { 00010 LARGE_INTEGER now; 00011 if (QueryPerformanceCounter(&now)) { 00012 return 1000000 * adr_u64(now.QuadPart) / frequency.QuadPart; 00013 } 00014 } 00015 00016 // no performance counter, so use the Win32 multimedia timer 00017 return timeGetTime() * 1000; 00018 }