C++中的Tickcount和毫秒

Sup*_*ing 4 c++ winapi

如何从TickCounts转换为毫秒?

这是我用过的:

long int before = GetTickCount();
long int after = GetTickCount();
Run Code Online (Sandbox Code Playgroud)

我希望它在几秒钟内有所不同.

Pri*_*lia 13

int seconds = (after - before) /1000;
Run Code Online (Sandbox Code Playgroud)


小智 6

为了更精确,还有 QueryPerformanceCounter()