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;