#include <boost/chrono.hpp>
boost::chrono
std::chrono
1234567891011121314151617181920212223242526272829
#include <iostream> #include <chrono> #include <boost/chrono.hpp> // link with libboost_chrono // http://www.boost.org/doc/libs/1_54_0/doc/html/chrono.html int main() { { using namespace std::chrono ; auto start = steady_clock::now() ; char c ; std::cin >> c ; auto dur = steady_clock::now() - start ; std::cout << duration_cast<milliseconds>(dur).count() << " milliseconds\n" ; } { using namespace boost::chrono ; auto start = steady_clock::now() ; char c ; std::cin >> c ; auto dur = steady_clock::now() - start ; std::cout << duration_cast<milliseconds>(dur).count() << " milliseconds\n" ; } }