Example of std::chrono timepoints.
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
#include <chrono> | |
#include <iostream> | |
int main() { | |
auto start = std::chrono::high_resolution_clock::now(); | |
long long some_number = 1799997; | |
for (unsigned i = 0; i<100000000; i++) { | |
some_number *= some_number; | |
} | |
auto end = std::chrono::high_resolution_clock::now(); | |
std::cout << "Operation took: " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms" << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment