Skip to content

Instantly share code, notes, and snippets.

@kantoniak
Created April 13, 2017 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kantoniak/c54310ecce707fd8a95674c13311b63d to your computer and use it in GitHub Desktop.
Save kantoniak/c54310ecce707fd8a95674c13311b63d to your computer and use it in GitHub Desktop.
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