time measurement c 2b 2b

Solutions on MaxInterview for time measurement c 2b 2b by the best coders in the world

showing results for - "time measurement c 2b 2b"
Alessio
21 Jan 2017
1//***C++11 Style:***
2#include <chrono>
3
4std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
5std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
6
7std::cout << "Time difference = " << std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count() << "[µs]" << std::endl;
8std::cout << "Time difference = " << std::chrono::duration_cast<std::chrono::nanoseconds> (end - begin).count() << "[ns]" << std::endl;
9