test_9337.cpp 604 B

123456789101112131415161718192021222324252627
  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. using namespace std;
  7. using namespace boost::chrono;
  8. template <typename Clock>
  9. void test()
  10. {
  11. typename Clock::time_point start=Clock::now();
  12. sleep(1);
  13. typename Clock::time_point stop=Clock::now();
  14. cout<<stop-start<<endl;
  15. cout << start <<endl;
  16. cout << stop <<endl;
  17. }
  18. int main() {
  19. test<process_cpu_clock>();
  20. test<process_real_cpu_clock>();
  21. test<process_user_cpu_clock>();
  22. test<process_system_cpu_clock>();
  23. return 1;
  24. }