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