GetTickCount(),看这段代码开始与结束的差值! If you need a higher resolution timer, use amultimedia timer or a high-resolution timer.
来迟了, GetTickCountGetTickCount The GetTickCount function retrieves the number of milliseconds that have elapsed since the system was started. It is limited to the resolution of the system timer. If you need a higher resolution timer, use amultimedia timer or a high-resolution timer. DWORD GetTickCount(VOID)
Parameters This function has no parameters. Return Values The return value is the number of milliseconds that have elapsed since the system was started.
For higher time resolution, the following methods may help youQueryPerformanceFrequency() & QueryPerformanceCounter()you can retrieve system frequencies, starting point frequency count and current frequency count. Use current frequency count minus starting point frequency count, then divide by system frequency, you can get the accurate time cost.
If you need a higher resolution timer, use amultimedia timer or a high-resolution timer.
GetTickCountGetTickCount
The GetTickCount function retrieves the number of milliseconds that have elapsed since the system was started. It is limited to the resolution of the system timer. If you need a higher resolution timer, use amultimedia timer or a high-resolution timer. DWORD GetTickCount(VOID)
Parameters
This function has no parameters. Return Values
The return value is the number of milliseconds that have elapsed since the system was started.
开始计时:DWORD dwStart = GetTickCount();
结束:GetTickCount() - dwStart;
CTime TimeStart,TimeEnd,TimeSecond,TimeMinute;
CTimeSpan SpanElapsed;
TimeStart = CTime::GetCurrentTime();
// ... perform time-consuming task TimeEnd = CTime::GetCurrentTime();
SpanElapsed = TimeEnd - TimeStart;
TimeSecond=SpanElapsed.GetTotalSeconds();
TimeMinute=SpanElapsed.GetTotalMinutes();