C++ timer计时设计

#include <ctime>
namespace my_timer
{
 class timer
 {
 public:
  timer(){ _start_time = std::clock();}; 
  void restrart(){_start_time = std::clock();};

  double elapsed() const{return  double(std::clock() - _start_time) / CLOCKS_PER_SEC; }
  double elapsed_max() const {}
  double elapsed_min() const{return double(1)/double(CLOCKS_PER_SEC);}
 private:
  clock_t  _start_time;
 };

}

posted @ 2013-06-28 21:23  Predator  阅读(403)  评论(0编辑  收藏  举报