(原)win32 计时

 struct StopWatch
 { 
 private:
  LONGLONG _oldtime;
 public :
  StopWatch()
  {
   Start();
  }
  void Start()
  {
   QueryPerformanceCounter((LARGE_INTEGER*)&_oldtime);
  }

  float GetSecond()
  {
   LONGLONG temptime = 0L;
   QueryPerformanceCounter((LARGE_INTEGER*)&temptime);
   LONGLONG _time = 0L;
   QueryPerformanceFrequency((LARGE_INTEGER*)&_time);
   double d = static_cast<double> ((temptime - _oldtime ) * 1000000 / _time);
   d /= 1000000;
   float f ;
   f = static_cast<float> (d);
   return f;
  }
 };

转载请注明 tsys2000@gmail.com

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页