Retrieves the number of milliseconds that have elapsed since the system was started, up to 49.7 days.
Syntax
DWORD WINAPI GetTickCount(void);
Parameters
This function has no parameters.
Return Value
The return value is the number of milliseconds that have elapsed since the system was started.
Remarks
The resolution is limited to the resolution of the system timer. This value is also affected by adjustments made by the
GetSystemTimeAdjustment function.
The elapsed time is stored as a DWORD value. Therefore, the time will wrap around to zero if the system is run continuously for 49.7 days. To avoid this problem, use GetTickCount64. Otherwise, check for an overflow condition when comparing times.
If you need a higher resolution timer, use a
multimedia timer or a
high-resolution timer.
To obtain the time elapsed since the computer was started, retrieve the System Up Time counter in the performance data in the registry key HKEY_PERFORMANCE_DATA. The value returned is an 8-byte value. For more information, see
Performance Counters.
Requirements
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| Header | Winbase.h (include Windows.h) |
| Library | Kernel32.lib |
| DLL | Kernel32.dll |
See Also
- Time Functions
Send comments about this topic to Microsoft
Build date: 5/14/2009