我试图在我的代码中计算函数的执行(这需要一个多小时),并且我正在使用时钟(),但是我遇到了一些错误,因为计算的时间是负数。我正在这样做:
long double time;
clock_t start, t_end;
t_start = clock();
algorithm->execute();
t_end = clock();
time = ((long double) t_end - t_start) / CLOCKS_PER_SEC;
cout << time << endl;
难道我做错了什么?