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