timer

i have an image, and i want to move it, say 1 unit per second, using
glTranslate(movement,0.0f,0.0f);
how can implement a timer function, i tried with the ones in nehes page but they didnt work

rather that a timer, why not use the time between frames as a global step?

// stuff for the timeGetTime() function
// assumes windows platform
#include <mmsystem.h>
#pragma comment( lib, "winmm" )

// globalTime in milliseconds
DWORD globalTime = 0;

...

void everyFrame() {

// don't let the first frame be too excessive
static bool first = true;
if( first ){
first      = false;
globalTime = timeGetTime() - 30;
}
 
DWORD time  = timeGetTime();
DWORD delta = time - globalTime; 
globalTime  = time;
 
// some function that updates everything
// to convert this to a float time in seconds, 
// divide it by 1000.0
updateEverything( delta );  
}

timeGetTime() is not the best time function in the world, but it’s not a bad start.

timers are not bad things, but you may find that this method is far more flexible.

thanks that helped