#include #include #include using namespace std; constexpr static size_t TRIALS = 100000; int main() { chrono::microseconds diffs_ms{0}; for (size_t loop_var = 1; loop_var <= TRIALS; ++loop_var) { auto t1 = chrono::high_resolution_clock::now(); auto t2 = chrono::high_resolution_clock::now(); diffs_ms += chrono::duration_cast(t2 - t1); } print("measuring the clock in c++ 23 {} trials had an average time duration " "of: {} microseconds, or {} milliseconds", TRIALS, diffs_ms / TRIALS, chrono::duration_cast(diffs_ms / TRIALS)); return 0; }