19 #ifndef __VFN_CHRONOMETER__
20 #define __VFN_CHRONOMETER__
25 #include "boost/date_time/posix_time/posix_time_types.hpp"
38 void start() {mPaused=
false;mTime0=boost::posix_time::microsec_clock::local_time();}
39 void pause() {mTime1=boost::posix_time::microsec_clock::local_time();mPaused=
true;}
42 mTime0=boost::posix_time::microsec_clock::local_time()-(mTime1-mTime0);
47 if(mPaused ==
false) mTime1=boost::posix_time::microsec_clock::local_time();
48 cout.setf(ios::fixed);
49 int tmp=cout.precision(2);
50 cout <<
"Elapsed time : " << this->seconds() <<
" s."<<endl ;
52 cout.unsetf(ios::fixed);
58 mTime1=boost::posix_time::microsec_clock::local_time();
60 return (mTime1-mTime0).total_microseconds()/1.0e6;
64 boost::posix_time::ptime mTime0;
65 boost::posix_time::ptime mTime1;
Simple chronometer class, with microsecond precision.