Beispiel #1
0
void Timer::stop()
{
  mIsStarted = false;
#if WIN32
  QueryPerformanceCounter(&mTimer.stop);
  LARGE_INTEGER time;
  time.QuadPart = mTimer.stop.QuadPart - mTimer.start.QuadPart;
  mLastElapsedTime = _convLIToSecs(time);
#else
  mStoppedTime = clock();
  mLastElapsedTime = _subtractTimes(mStoppedTime, mStartedTime);
#endif
  mTotalElapsedTime += mLastElapsedTime;
}
Beispiel #2
0
double Timer::getElapsedTime()
{
#if WIN32
  LARGE_INTEGER timenow;
  QueryPerformanceCounter(&timenow);
  LARGE_INTEGER time;
  time.QuadPart = timenow.QuadPart - mTimer.start.QuadPart;
  mLastElapsedTime = _convLIToSecs(time);
#else
  double now = clock();
  mLastElapsedTime = _subtractTimes(now, mStartedTime);
#endif
  return mLastElapsedTime;
}
Beispiel #3
0
//==============================================================================
void Timer::stop()
{
  mIsStarted = false;
#ifdef _WIN32
  QueryPerformanceCounter(&mTimer.stop);
  LARGE_INTEGER time;
  time.QuadPart = mTimer.stop.QuadPart - mTimer.start.QuadPart;
  mLastElapsedTime = _convLIToSecs(time);
#else
  gettimeofday(&mTimeVal, nullptr);
  mStoppedTime = mTimeVal.tv_sec + (mTimeVal.tv_usec / 1.0e+6);
  mLastElapsedTime = mStoppedTime - mStartedTime;
#endif
  mTotalElapsedTime += mLastElapsedTime;
}
Beispiel #4
0
//==============================================================================
double Timer::getElapsedTime()
{
#ifdef _WIN32
  LARGE_INTEGER timenow;
  QueryPerformanceCounter(&timenow);
  LARGE_INTEGER time;
  time.QuadPart = timenow.QuadPart - mTimer.start.QuadPart;
  mLastElapsedTime = _convLIToSecs(time);
#else
  gettimeofday(&mTimeVal, nullptr);
  mLastElapsedTime = mTimeVal.tv_sec + (mTimeVal.tv_usec / 1.0e+6)
                     - mStartedTime;
#endif
  return mLastElapsedTime;
}