[ODE] dt computation

J. Perkins starkos at gmail.com
Sat Apr 1 18:53:02 MST 2006


On 4/1/06, Bram Stolk <bram at sara.nl> wrote:
> I propose a function double dsElapsedTime(void) that returns the nr of
> seconds since the last call to this func.

On second thought, why don't you just check in a linux version and I
will write one for windows. I'd like to be able to test it before it
gets put into the repository. But the stupid simple version goes like
this (people feel free to jump in with a better version)

#include <mmsystem.h>

static DWORD _lastTickCount = 0;

double dsElapsedTime(void)
{
   DWORD currTickCount = timeGetTime();
   double elapsed = (_lastTickCount == 0) ? 0.0 : (currTickCount -
_lastTickCount) / 1000.0;
   _lastTickCount = currTickCount;
  return elapsed;
}

The tests will also have to link with winmm.lib.

Jason



More information about the ODE mailing list