Last active
August 11, 2023 11:17
-
-
Save zorchp/b42d7fa678dc77b06c2ef0cb7561b5fe to your computer and use it in GitHub Desktop.
for-record-time-spent
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> | |
using namespace std; | |
using namespace std::chrono; | |
auto start = system_clock::now(); | |
// do something... | |
auto end = system_clock::now(); | |
auto duration = duration_cast<microseconds>(end - start); | |
cout << "Time spent: " | |
<< double(duration.count()) * microseconds::period::num / | |
microseconds::period::den | |
<< "s" << endl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment