1.精确到毫秒时GetLocalTime
_SYSTEMTIME st;
GetLocalTime(&st);
CString strTime;
strTime.Format(_T("%d%d%d%d%d%d%d"), st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute
,st.wSecond, st.wMilliseconds);
2.精确到秒时GetCurrentTime()
CTime time = CTime::GetCurrentTime();//必须使用CTime::下的get函数,否则得到的时间不对
CString strFile = time.Format("%Y%m%d-%H%M%S");
3.计算某段时间差时 GetTickCount()
long t1 = GetTickCount();
中间为操作
long t2 = GetTickCount();
//中间为操作
long t3 = GetTickCount();
long tt1 = t2 - t1;//时间差