Core/Time: Remove artificially high minimal update intervals

Port From (https://github.com/TrinityCore/TrinityCore/commit/3a67e376811743be208da4aab8a9e452e1ae637e)
This commit is contained in:
hondacrx
2022-02-22 13:54:46 -05:00
parent 8ce8408f91
commit 338a861cd9
5 changed files with 14 additions and 13 deletions
+8 -7
View File
@@ -31,7 +31,7 @@ namespace WorldServer
{
public class Server
{
const uint WorldSleep = 50;
const uint WorldSleep = 1;
static void Main()
{
@@ -189,14 +189,15 @@ namespace WorldServer
var realCurrTime = Time.GetMSTime();
uint diff = Time.GetMSTimeDiff(realPrevTime, realCurrTime);
if (diff == 0)
{
// sleep until enough time passes that we can update all timers
Thread.Sleep(1);
continue;
}
Global.WorldMgr.Update(diff);
realPrevTime = realCurrTime;
uint executionTimeDiff = Time.GetMSTimeDiffToNow(realCurrTime);
// we know exactly how long it took to update the world, if the update took less than WORLD_SLEEP_CONST, sleep for WORLD_SLEEP_CONST - world update time
if (executionTimeDiff < WorldSleep)
Thread.Sleep((int)(WorldSleep - executionTimeDiff));
}
}