GetTickCount64

Windows Sysinfo API - Retrieve system uptime

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

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;
}
                

Related Functions