流云の剑舞秋风

吾生也有涯 而知也无涯

博客园 首页 新随笔 联系 订阅 管理

 CString str;
 //获取系统时间
 CTime tm;
 tm=CTime::GetCurrentTime();
 str=tm.Format("现在时间是%Y年%m月%d日  %X");
 MessageBox(str,NULL,MB_OK);


//获取程序运行时间
 long t1=GetTickCount();//程序段开始前取得系统运行时间(ms)
 Sleep(500);
 long t2=GetTickCount();();//程序段结束后取得系统运行时间(ms)
 str.Format("time:%dms",t2-t1);//前后之差即 程序运行时间
 AfxMessageBox(str);

posted on 2005-05-16 11:02  流云  阅读(995)  评论(0编辑  收藏  举报