Function Declaration
ULONGLONG GetTickCount64(void);
Parameters
This function does not take any parameters.
Return Value
The return value is the number of milliseconds that have elapsed since the system was started.
The return value is a 64-bit integer. The resolution of the return value is the same as that of the system's high-resolution performance counter, if the hardware has a high-resolution performance counter. Otherwise, the resolution of the return value is 10-15 milliseconds.
Description
The GetTickCount64 function retrieves the number of milliseconds that have elapsed since the system was started.
This function is a 64-bit version of GetTickCount. It is recommended for new applications because the 32-bit GetTickCount function can roll over in approximately 49.7 days. GetTickCount64 will roll over in approximately 5.8 million years.
Remarks
- The system tick count starts at 0 when the system is started.
- The tick count is not affected by the system's time of day.
- The tick count is not affected by whether the system clock is set backward or forward.
- The tick count can be used to time operations. For example, you can retrieve the tick count before and after an operation, and the difference will be the time elapsed in milliseconds.
System Requirements
| Minimum supported client | Windows Vista [desktop apps only] |
|---|---|
| Minimum supported server | Windows Server 2008 [desktop apps only] |
| Header | Winbase.h (include Windows.h) |
| Library | Kernel32.lib |
| DLL | Kernel32.dll |
Example
#include <windows.h>
#include <stdio.h>
int main() {
ULONGLONG tickCount = GetTickCount64();
printf("System has been up for %llu milliseconds.\n", tickCount);
return 0;
}