Last active
September 10, 2019 13:43
-
-
Save hertzsprung/f46728daad35b41b7598f773c17159d4 to your computer and use it in GitHub Desktop.
C++ timers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// adapted from https://stackoverflow.com/a/32241080/150884 | |
#include <chrono> | |
#include <iostream> | |
using Clock = std::chrono::high_resolution_clock; | |
auto t1 = Clock::now(); | |
// do stuff | |
auto t2 = Clock::now(); | |
std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(t2-t1).count() << "ms" << std::endl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment