23 #ifndef GUDHI_CLOCK_H_
24 #define GUDHI_CLOCK_H_
27 #include <boost/date_time/posix_time/posix_time.hpp>
32 Clock():end_called(false){
33 startTime = boost::posix_time::microsec_clock::local_time( );
36 Clock(
const std::string& msg_){
45 startTime = boost::posix_time::microsec_clock::local_time( );
50 endTime = boost::posix_time::microsec_clock::local_time( );
54 std::cout << *
this << std::endl;
57 friend std::ostream& operator<< (std::ostream& stream,
const Clock& clock){
61 if(!clock.end_called) stream <<
"end not called";
63 stream << clock.msg <<
":"<<clock.num_seconds() <<
"s";
69 double num_seconds()
const{
70 if(!end_called)
return -1;
71 return (endTime-startTime).total_milliseconds()/1000.;
75 mutable boost::posix_time::ptime startTime, endTime;
76 mutable bool end_called;