use time in c++ code example
Example 1: time function c++
#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;
Example 2: time function c++
#include <chrono>
using namespace std::chrono;
auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
cout << duration_cast<microseconds>(stop - start).count() << endl;
Example 3: how to get current time in c++
#include <ctime>
time_t tt;
time( &tt );
tm TM = *localtime( &tt );
int month=TM.tm_mon+1;
int day=TM.tm_mday;
int year=TM.tm_year+1900;