mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[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:
parent
6833efe12e
commit
7d6b52641b
2 changed files with 4 additions and 17 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11486"
|
||||
#define REVISION_NR "11487"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue