Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of std::chrono timepoints.
#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
You can’t perform that action at this time.