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
7using namespace std;
8using namespace boost::chrono;
9
10template <typename Clock>
11void test()
12{
13 typename Clock::time_point start=Clock::now();
14 sleep(seconds: 1);
15 typename Clock::time_point stop=Clock::now();
16 cout<<stop-start<<endl;
17 cout << start <<endl;
18 cout << stop <<endl;
19}
20
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

source code of boost/libs/chrono/test/test_9337.cpp