Files
Leviathan/Library/Internal/source/toolkit/SafeTickCount.cpp
T
2026-06-01 12:46:52 +02:00

23 lines
396 B
C++

#include "../../include/toolkit/SafeTickCount.h"
#include <limits>
DWORD GetSafeTickCount()
{
static DWORD s_dwStartTick = ::GetTickCount() - 1;
DWORD dwCurrentTick = ::GetTickCount();
if( dwCurrentTick < s_dwStartTick )
{
dwCurrentTick = (std::numeric_limits< DWORD >::max)() - s_dwStartTick + dwCurrentTick;
}
else
{
dwCurrentTick -= s_dwStartTick;
}
return dwCurrentTick;
}