Added high resolution timing API: SDL_GetPerformanceCounter(), SDL_GetPerformanceFrequency()

This commit is contained in:
Sam Lantinga 2011-03-25 14:45:04 -07:00
parent 98e5ddb37d
commit 85ad17e7d6
8 changed files with 127 additions and 1 deletions

View file

@ -99,6 +99,28 @@ SDL_GetTicks(void)
return (ticks);
}
Uint64
SDL_GetPerformanceCounter(void)
{
LARGE_INTEGER counter;
if (!QueryPerformanceCounter(&counter)) {
return SDL_GetTicks();
}
return counter.QuadPart;
}
Uint64
SDL_GetPerformanceFrequency(void)
{
LARGE_INTEGER frequency;
if (!QueryPerformanceFrequency(&frequency)) {
return 1000;
}
return frequency.QuadPart;
}
void
SDL_Delay(Uint32 ms)
{