Ensure that all actions are compared to fixed point in time (ie. world update start)

Port From (https://github.com/TrinityCore/TrinityCore/commit/60663d1374beef3103f4787152654034fa4a8897)
This commit is contained in:
hondacrx
2019-09-01 10:37:14 -04:00
parent dccded6a96
commit 87d30caa49
38 changed files with 302 additions and 169 deletions
+52
View File
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Text;
public class GameTime
{
static long StartTime = Time.UnixTime;
static long _gameTime = 0;
static uint _gameMSTime = 0;
static DateTime _gameTimeSystemPoint = DateTime.MinValue;
static DateTime _gameTimeSteadyPoint = DateTime.MinValue;
public static long GetStartTime()
{
return StartTime;
}
public static long GetGameTime()
{
return _gameTime;
}
public static uint GetGameTimeMS()
{
return _gameMSTime;
}
public static DateTime GetGameTimeSystemPoint()
{
return _gameTimeSystemPoint;
}
public static DateTime GetGameTimeSteadyPoint()
{
return _gameTimeSteadyPoint;
}
public static uint GetUptime()
{
return (uint)(_gameTime - StartTime);
}
public static void UpdateGameTimers()
{
_gameTime = Time.UnixTime;
_gameMSTime = Time.GetMSTime();
_gameTimeSystemPoint = DateTime.Now;
_gameTimeSteadyPoint = DateTime.Now;
}
}