SDL Timer question

Does anyone know how the SDL_GetTicks stuff works at a little bit lower
level?
I am using Linux (FD3). I have an embedded program/system that requires
me to set the time and date. I am using the hwclock system call
because I have found really strange behavior when I use localtime().
This seems to work, but I have not done a whole bunch of testing. What
I need to know is that the SDL_GetTicks is from the initialization of
the SDL library, would this be effected by changing the system/hwclock?
Again I have not seen any stange behavior. (yet). If this this is
effected by the system clock is there a way to restate the start timer
of the SDL_GetTicks.

Any help is appreciated,
Walt

walt wrote:

Does anyone know how the SDL_GetTicks stuff works at a little bit
lower level?
I am using Linux (FD3). I have an embedded program/system that
requires me to set the time and date. I am using the hwclock system
call because I have found really strange behavior when I use
localtime(). This seems to work, but I have not done a whole bunch of
testing. What I need to know is that the SDL_GetTicks is from the
initialization of the SDL library, would this be effected by changing
the system/hwclock? Again I have not seen any stange behavior.
(yet). If this this is effected by the system clock is there a way to
restate the start timer of the SDL_GetTicks.

SDL uses rdtsc on systems that support it (i.e. on x86).
As such, it should not be affected by a clock change.
Other platforms might be affected, though.

Stephane

[…]

No, rdtsc is disabled by default.
See src/timer/linux/SDL_systimer.c

You have to recompile SDL with USE_RDTSC defined.

Johannes Schmidt

< http://libufo.sourceforge.net > The OpenGL GUI ToolkitAm Dienstag 23 November 2004 23:27 schrieb Stephane Marchesin:

walt wrote:

Does anyone know how the SDL_GetTicks stuff works at a little bit
lower level?
I am using Linux (FD3). I have an embedded program/system that
requires me to set the time and date. I am using the hwclock system
call because I have found really strange behavior when I use
localtime(). This seems to work, but I have not done a whole bunch of
testing. What I need to know is that the SDL_GetTicks is from the
initialization of the SDL library, would this be effected by changing
the system/hwclock? Again I have not seen any stange behavior.
(yet). If this this is effected by the system clock is there a way to
restate the start timer of the SDL_GetTicks.

SDL uses rdtsc on systems that support it (i.e. on x86).
As such, it should not be affected by a clock change.

Does anyone know how the SDL_GetTicks stuff works at a little bit lower
level?
I am using Linux (FD3). I have an embedded program/system that requires
me to set the time and date. I am using the hwclock system call
because I have found really strange behavior when I use localtime().
This seems to work, but I have not done a whole bunch of testing. What
I need to know is that the SDL_GetTicks is from the initialization of
the SDL library, would this be effected by changing the system/hwclock?
Again I have not seen any stange behavior. (yet). If this this is
effected by the system clock is there a way to restate the start timer
of the SDL_GetTicks.

SDL uses gettimeofday by default. I’m not sure what effect setting the
hardware clock would have on this.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment