c 2b 2b show time elapsed

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

showing results for - "c 2b 2b show time elapsed"
Elisa
04 Jan 2021
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;