I am trying to use time() to measure various points of my program.
What I don\'t understand is why the values in the before and after are the same? I understand thi
#include
#include
using namespace std;
void f() {
clock_t begin = clock();
// ...code to measure time...
clock_t end = clock();
function convtime = [](clock_t begin, clock_t end)
{
return double(end - begin) / CLOCKS_PER_SEC;
};
printf("Elapsed time: %.2g sec\n", convtime(begin, end));
}
Similar example to one available here, only with additional conversion function + print out.