global clock problem

I have a task that updates my airplane game.

AsyncTask::DoneStatus GamePlayTask(GenericAsyncTask* task, void* data) {

   if (bKeyPressed)
cout<<"time is:"<<globalClock->get_frame_time()<<endl;


  // Tell the task manager to continue this task the next frame.
  return AsyncTask::DS_cont;

....start main() and the window and stuff...

taskMgr->add(new GenericAsyncTask("Runs the Game",&GamePlayTask, (void*) NULL));


The problem is that globalClock->get_frame_time() is increasing every frame, its giving me the exact same value as globalClock->get_real_time().
So my airplane is moving and turning faster and faster as the application runs. I thought that maybe its because globalClock->tick() wasn’t being called automatically so I tried manually calling it in the beginning of my task, but with no apparent improvement.

I did make a workaround by declaring a double called OldTime and using it with globalClock->get_real_time();

Airplane::S_OnLoop(globalClock->get_real_time() - OldTime);
	OldTime = globalClock->get_real_time();

but the fact that get_frame_Time didn’t work still bothers me.

while it is not a real answer to your question. have you tried to use globalClock->get_dt() ?

Ok, tried it and get_dt() works fine without using any fancy tricks. So there are two solutions to MY problem but THE problem still exists. get_frame_time() is acting up. Guess I should report it in the bugs section.

No, this is the way get_frame_time() is supposed to behave. It doesn’t report the length of the current frame (that’s what get_dt() reports); instead, it reports the starting time of the current frame.

From the API reference:


Oh, ok that makes sense.
thanks David