#include #include #include #include #include #include int main ( void ) {try{ boost::chrono::process_cpu_clock clock; boost::chrono::process_cpu_clock::time_point b = clock.now(); std::this_thread::sleep_for( std::chrono::seconds( 2 ) ); boost::chrono::process_cpu_clock::time_point e = clock.now(); boost::chrono::process_cpu_clock::duration d = e - b; auto times = d.count(); std::cout << times.real / 1e+9 << std::endl; std::cout << times.user / 1e+9 << std::endl; std::cout << times.system / 1e+9 << std::endl; return 0; } catch ( const std::exception& e ) { std::cerr << std::endl << "std::exception(\"" << e.what() << "\")." << std::endl; } catch ( ... ) { std::cerr << std::endl << "unknown exception." << std::endl; }}