I'm following a tutorial about the time management and, the tutorial shows this function:
double GetFrameTime()
{
LARGE_INTEGER currentTime;
__int64 tickCount;
QueryPerformanceCounter(¤tTime);
tickCount = currentTime.QuadPart-frameTimeOld;
frameTimeOld = currentTime.QuadPart;
if(tickCount < 0.0f)
tickCount = 0.0f;
return float(tickCount)/countsPerSecond;
}
The tutorial explains that, this function basically gets the time that one frame takes, but, I don't understand how the variable tickCount can be negative, if the currentTime is increasing all the time (calling this function every frame, obviously), so, is that if really necessary?
QueryPerformanceCountersensitive to, for example, the user changing the system time? \$\endgroup\$