views:

229

answers:

1

This question is inspired by Does Linux provide a monotonically increasing clock to applications.

Maybe I should be more precise: I'm looking for a clock function which is strictly increasing, thus never returning the same value, independant how quick two calls follow each other.

+1  A: 

Yes, GetTickCount() does this. If you want a higher fidelity counter, QueryPerformanceCounter is also available. Neither of these counters depend on the time of day.

Greg Hewgill
Should change your link to GetTickCount64() -- from your link, the return value of GTC wraps after about 50 days.
John Millikin
GetTickCount64() is only available on Windows Vista or Windows Server 2008.
Greg Hewgill
As long as you can rely on being called at least once a month or so, you can cobble together a GetTickCount64() wrapper around GetTickCount().
Michael Burr