CTime time = CTime::GetCurrentTime(); //获取系统日期
CString date = time.Format(_T("%Y-%m-%d %H:%M:%S %W-%A"));//2006-10-13 17:23:47 41-Friday
如果当前时间大于指定的时间,函数返回false
bool CompareTime(int nYear, int nMonth, int nDay)
{
CTime t(nYear, nMonth, nDay, 0, 0, 0);
if (CTime::GetCurrentTime() > t)
return FALSE;
return true;
}
int main()
{
bool bRet = CompareTime(2021,6,10);
}
CString str;
long t1 = GetTickCount(); //程序段开始前系统运行时间
long t2 = GetTickCount(); //程序段结束后系统运行时间
str.Format(_T("\ntime:%dms"), t2 - t1); //前后之差即程序运行时间
acutPrintf(str);