在mfc中如何显示出系统时间

哎,都哭了,MFC中不能在控制台显示时间?

百度了一把 发现这个很管用:

 1 //使用GetTickCount
 2 CString   str; 
 3 //获取程序运行时间
 4 long t1=GetTickCount();//程序段开始前取得系统运行时间(ms)
 5 Sleep(500);
 6 //主程序
 7 long t2=GetTickCount();//程序段结束后取得系统运行时间(ms)
 8 
 9 str.Format("time:%dms",t2-t1);//前后之差即 程序运行时间
10 AfxMessageBox(str);

 

posted @ 2013-11-19 01:13  木瀆  阅读(422)  评论(0编辑  收藏  举报