1 //#define BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 2 #include <iostream> 3 #include <unistd.h> 4 #include <boost/chrono.hpp> 5 #include <boost/chrono/chrono_io.hpp> 6 7 using namespace std; 8 using namespace boost::chrono; 9 10 template <typename Clock> test()11void test() 12 { 13 typename Clock::time_point start=Clock::now(); 14 sleep(1); 15 typename Clock::time_point stop=Clock::now(); 16 cout<<stop-start<<endl; 17 cout << start <<endl; 18 cout << stop <<endl; 19 } 20 main()21int main() { 22 test<process_cpu_clock>(); 23 test<process_real_cpu_clock>(); 24 test<process_user_cpu_clock>(); 25 test<process_system_cpu_clock>(); 26 return 1; 27 } 28