[SDL] Timer accuracy

Matt Greer matthew-greer at uiowa.edu
Fri Sep 13 04:04:01 PDT 2002


On Thursday 12 September 2002 07:24 pm, Neil Bradley wrote:
> Is there any way in SDL to figure out how accurate (I.E. what granularity)
> the timer functions give off?

What about directly measure it? Something like

Uint32 samples[500];
Uint32 curTick;

curTick = SDL_GetTicks();
for(int i = 0; i < 500; ++i)
{
	while(SDL_GetTicks() == curTick);

	curTick = samples[i] = SDL_GetTicks();
}

Perhaps not perfect, but it could give you an idea.

Matt






More information about the SDL mailing list