I want to know what does the Windows API GetTickCount()
actually measure? Does it measure the time from the instant the power button of the system is pressed? Does it measure the time taken by bootloaders or BIOS to load as well?
I am trying to measure the boot time on Windows 7.
The return value is the number of milliseconds that have elapsed since the system was started.
The GetTickCount function has a precision of one millisecond, but its accuracy is typically much worse, dependent on your timer tick rate, typically 10ms to 55ms.
You should not treat it as measuring the time "since" anything. Use it only as a relative clock source. In other words, call GetTickCount
once, then do something, then call it again, then subtract. Do not use the absolute value of the tick count.
The precise start time is unspecified, and on debugging builds of Windows, the "boot time" is artificially set to 49.7 days in the past in order to expose timer rollover bugs.
Since the official documentation doesn't specify, you can only assume that the precise moment during startup is not really defined, and it could work differently on different versions of Windows. But consider that with virtualization and emulation, "since the power button was pushed" would be meaningless. The best consistent definition you could hope for would be the moment that Windows starts serving interrupts -- the earliest moment that the system clock is available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With