系统计时
时间要求比较精确时:DWORD t1 = GetTickCount();
DWORD t2 = GetTickCount();
运行时间:T= t2 - t1;
时间较长时:
Word Hour,Min,Sec,MSec;
StartDateTime = Now(); //开始计时
double Temp = Now() - StartDateTime;
DecodeTime((Temp - int(Temp)),Hour,Min,Sec,MSec);
LblRunTime->Caption = "系统已经运行: "+String(int(Temp)*24+Hour)+"小时"+String(Min)+"分 "+String(Sec)+"秒";
#include "stdio.h"
#include "time.h"
int main( )
{
long start,end;
start = clock();
//测试的程序段
end = clock();
printf("%ld\n",start-end);//单位:毫秒
return 0;
}