Using std::chrono
you could use a non-blocking elapsed timer in the following manner
call this at the beginning of the desired time measurement:
std::chrono::steady_clock::time_point begin_time = std::chrono::steady_clock::now();
call this at the end of the desired time measurement:
std::chrono::steady_clock::time_point end_time = std::chrono::steady_clock::now();
compute the elapsed time:
std::chrono::steady_clock::time_point elapsed = end_time - begin_time;
If lower resolution is desired such as minutes or hours, std::chrono
can be adapted using std::chrono::steady_clock::minutes(/*num minutes*/)
or `std::chrono::steady_clock::hours(/*num hours*/)