Doug T.
Doug T.

Reputation: 65639

Is QueryPerformanceCounter guaranteed to give you time since boot?

Is it safe to assume that the count returned from QueryPerformanceCounter relates to the time since the last system boot? Or could it be reset while the system is running? The MSDN article itself doesn't guarantee this, however I've seen some 3rd party information (such as this) that says that this is the case.

Upvotes: 1

Views: 932

Answers (1)

Mysticial
Mysticial

Reputation: 471409

It's meant to be used for relative times. But I don't think it can be used to measure time since boot.

From what I hear, it's implemented using the rdtsc instruction which measures "pseudo" CPU cycles since the CPU was powered on. In that case, yes, it probably does give the time since boot, but I don't think this is specified.

Upvotes: 3

Related Questions