SDL Timer funtions

What are the SDL equivalents of the following 2 Windows Timer functions…

bool Init()
{
if (!QueryPerformanceFrequency(&m_ticksPerSecond))
{
// system doesn’t support hi-res timer
return false;
}
else
{
QueryPerformanceCounter(&m_startTime);
return true;
}
} // end Init()

float GetElapsedSeconds(unsigned long elapsedFrames = 1)
{
static LARGE_INTEGER s_lastTime = m_startTime;
LARGE_INTEGER currentTime;

QueryPerformanceCounter(&currentTime);

float seconds = ((float)currentTime.QuadPart -
(float)s_lastTime.QuadPart) / (float)m_ticksPerSecond.QuadPart;

// reset the timer
s_lastTime = currentTime;

return seconds;
} // end GetElapsedSeconds()–
Dominique
http://www.DelphiGamer.com := go on, write a game instead;

Dominique Louis wrote:

What are the SDL equivalents of the following 2 Windows Timer
functions…

[…]

You can use SDL_GetTicks for that. It depends on the precision you
expect ; SDL_GetTicks goes down to the millisecond and uses rdtsc if
available (what you also know as “performance counters”). Precision
will vary from one platform to another, but is usually enough.

Stephane