MFC获取系统当前时间+程序执行时间+系统开启时间

    技术2022-07-14  59

     

    一、目的

    1、

     

    二、参考

    1、MFC获取系统当前时间

    https://www.cnblogs.com/bigbigtree/archive/2011/12/02/2272066.html

    ①操作:成功

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

    ②操作:成功

    SYSTEMTIME st; CString strDate,strTime; GetLocalTime(&st); strDate.Format(L"M----",st.wYear,st.wMonth,st.wDay); strTime.Format(L"-:-:-",st.wHour,st.wMinute,st.wSecond);

    ③操作:

    CString str,str1; long t1=GetTickCount(); Sleep(500); long t2=GetTickCount(); str.Format(L"time:%dms",t2-t1); AfxMessageBox(str); long t=GetTickCount(); str1.Format(L"系统已运行 %d时",t/3600000); str=str1; t%=3600000; str1.Format(L"%d分",t/60000); str+=str1; t%=60000; str1.Format(L"%d秒",t/1000); str+=str1; AfxMessageBox(str);

     

     

     

    三、操作

    1、

    Processed: 0.053, SQL: 9