1.用于获取当前系统时间Format 可按格式输出
CTime time = CTime::GetCurrentTime();
CTime time = CTime::GetCurrentTime();
string str = time.Format("%Y-%m-%d %H:%M:%S");
2. 用于秒级别的运算,一般用于函数观察程序运行时间,优化
#Include <windows.h>
double t 1= clock();
double t2 = clock();
cout<<t2-t1<<endl
3.time_t 函数,获取系统当前时间
#include <time.h>
time_t t = time(0);
char tmp[64];
strftime( tmp, sizeof(tmp), "%Y-%m-%d %H:%M:%S",localtime(&t) );