Hello
I'd like to measure time complexity that its needed for some algorithm/function to complete in my c++ application. I'd like to have it in miliseconds, double format (example: 0.253ms)
I've tried doing the following:
But this will only output 0.Code:#include <boost/date_time/posix_time/posix_time_types.hpp> //.. boost::posix_time::ptime start = boost::posix_time::microsec_clock::universal_time(); function(); boost::posix_time::time_duration time = boost::posix_time::microsec_clock::universal_time() - start; std::cout << "done in: " << (double)(time.total_microseconds()/1000.0) << " ms\n";
What am I doing wrong?
Is there any better way of doing this?
Thanks for help!