I wonder if is there any way to get only the time without printing out the units :
#include <boost/chrono.hpp>
#include <iostream>
boost::chrono::milliseconds sumGlobal;
int main() {
boost::chrono::high_resolution_clock::time_point t1 ;
boost::chrono::high_resolution_clock::time_point t2 ;
for (i=0;i<10;i++)
{
t1 = boost::chrono::high_resolution_clock::now();
f(); //to waste time
t2 = boost::chrono::high_resolution_clock::now();
sumGlobal += (boost::chrono::duration_cast<boost::chrono::milliseconds>(t2-t1));
}
std::cout << sumGlobal << "\n";
}
the Output is :
123 milliseconds
I'd like to get only
123
Any solutions ?