C++程序运行时间计算(#include time.h和 #include sys/time.h)


时间紧迫就暂时采用了这种方法计时,后面再进一步总结。

#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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM