GetTickCount() 返回的是 DWORD 如果机器开了很长时间 那么这个值就会溢出 微软提供了个新函数 GetTickCount64() 函数 但是这个函数是在 vista 上面才有,。。
网上抄的 自己改了下。。。
__int64 GetSysTickCount64()
{
static LARGE_INTEGER TicksPerSecond = {0};
LARGE_INTEGER Tick;
__int64 Ret = 0;
if(QueryPerformanceFrequency(&TicksPerSecond))
{
if(QueryPerformanceCounter(&Tick))
{
__int64 Seconds = Tick.QuadPart / TicksPerSecond.QuadPart;
__int64 LeftPart = Tick.QuadPart - (TicksPerSecond.QuadPart*Seconds);
__int64 MillSeconds = LeftPart*1000/TicksPerSecond.QuadPart;
Ret = Seconds*1000 + MillSeconds;
}
}
return Ret;
};