时间紧迫就暂时采用了这种方法计时,后面再进一步总结。
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
time_t start, end;
time(&start);
system("pause");
time(&end);
system("pause");
cout << end - start << endl;
return 0;
}
参考:
1.测试C/C++程序运行时间
2.#include time.h和 #include sys/time.h
3.GetLocalTime
4.C++ time(NULL) 计算持续的时间长度
5.time(NULL)的用法
6.c++ 时间类型详解 time_t
7.彻底搞清楚C/C++中日期和时间 time_t与struct tm,time(NULL),ctime;strftime