[11487] Fix WorldTimer code (previous code causes server time flow speed to be on ~ 1-2% slower than real time)

This commit is contained in:
SilverIce 2011-05-14 16:59:21 +03:00
parent 6833efe12e
commit 7d6b52641b
2 changed files with 4 additions and 17 deletions

View file

@ -59,24 +59,11 @@ uint32 WorldTimer::getMSTime_internal(bool savetime /*= false*/)
//calculate time diff between two world ticks
//special case: curr_time < old_time - we suppose that our time has not ticked at all
//this should be constant value otherwise it is possible that our time can start ticking backwards until next world tick!!!
uint32 diff = 0;
//regular case: curr_time >= old_time
if(currTime > g_SystemTickTime)
diff = (currTime - g_SystemTickTime).msec();
//reset last system time value
if(savetime)
g_SystemTickTime = currTime;
uint64 diff = 0;
(currTime - g_SystemTickTime).msec(diff);
//lets calculate current world time
uint32 iRes = m_iTime;
//normalize world time
const uint32 tmp = uint32(0xFFFFFFFF) - iRes;
if(tmp < diff)
iRes = diff - tmp;
else
iRes += diff;
uint32 iRes = uint32(diff % UI64LIT(0x00000000FFFFFFFF));
return iRes;
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11486"
#define REVISION_NR "11487"
#endif // __REVISION_NR_H__