Answers for "check time difference c++"

C++
1

calculate time difference cpp

#include <chrono>

auto t_start = std::chrono::high_resolution_clock::now();
// the work...
auto t_end = std::chrono::high_resolution_clock::now();

double elapsed_time_ms = std::chrono::duration<double, std::milli>(t_end-t_start).count();
Posted by: Guest on June-21-2021
0

c++ compare time

#include <chrono> 
using namespace std::chrono; 

auto start = high_resolution_clock::now(); 
auto stop = high_resolution_clock::now(); 
auto duration = duration_cast<microseconds>(stop - start); 
  
cout << duration.count() << endl;
Posted by: Guest on March-20-2021

Browse Popular Code Answers by Language