Skip to content

Commit

Permalink
Timer|Fixed: Time measurements past 12 hours of runtime
Browse files Browse the repository at this point in the history
Logic error in time measurement caused the timer to advance at a very
fast pace after hitting 12 hours, ultimately wrapping to negative time
values.
  • Loading branch information
skyjake committed Apr 12, 2012
1 parent 8c583df commit cc87e8e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion doomsday/engine/portable/src/timer.cpp
Expand Up @@ -89,12 +89,19 @@ unsigned int Sys_GetRealTime(void)
#ifdef WIN32
now = timeGetTime();
#else
now = uint(startedAt.elapsed()) + timerOffset;
now = uint(startedAt.elapsed());
if(now > TIMER_WARP_INTERVAL)
{
now += timerOffset;

// QTime will wrap around every 24 hours; we'll wrap it manually before that.
timerOffset += TIMER_WARP_INTERVAL;
startedAt = startedAt.addMSecs(TIMER_WARP_INTERVAL);
}
else
{
now += timerOffset;
}
#endif

if(first)
Expand Down

0 comments on commit cc87e8e

Please sign in to comment.