fix(core): Caches DateTime.NowUtc (#548)
- [X] Caches DateTime.NowUtc on the game loop (not other threads) - [X] Replaces all locations where it makes sense - [X] Adds Min/Max for `IComparable` (TimeSpan, DateTimes, etc) Closes #261
This commit is contained in:
parent
5de6edbeb8
commit
6c4308bce6
208 changed files with 660 additions and 793 deletions
|
|
@ -13,9 +13,9 @@ namespace Server.Engines.Events
|
|||
|
||||
public static void Initialize()
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
var now = Core.Now;
|
||||
|
||||
if (DateTime.UtcNow >= HolidaySettings.StartHalloween && DateTime.UtcNow <= HolidaySettings.FinishHalloween)
|
||||
if (now >= HolidaySettings.StartHalloween && now <= HolidaySettings.FinishHalloween)
|
||||
{
|
||||
EventSink.Speech += EventSink_Speech;
|
||||
}
|
||||
|
|
@ -165,7 +165,7 @@ namespace Server.Engines.Events
|
|||
return;
|
||||
}
|
||||
|
||||
var now = DateTime.UtcNow;
|
||||
var now = Core.Now;
|
||||
|
||||
if (CheckMobile(begged))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Server.Engines.Events
|
|||
|
||||
public static void Initialize()
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
var now = Core.Now;
|
||||
|
||||
if (now >= HolidaySettings.StartHalloween && now <= HolidaySettings.FinishHalloween)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace Server.Engines.Events
|
|||
m_QueueDelaySeconds = 120;
|
||||
m_QueueClearIntervalSeconds = 1800;
|
||||
|
||||
var today = DateTime.UtcNow;
|
||||
var today = Core.Now;
|
||||
var tick = TimeSpan.FromSeconds(m_QueueDelaySeconds);
|
||||
var clear = TimeSpan.FromSeconds(m_QueueClearIntervalSeconds);
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ namespace Server.Engines.Events
|
|||
|
||||
m_DeathQueue.Clear();
|
||||
|
||||
if (DateTime.UtcNow <= HolidaySettings.FinishHalloween)
|
||||
if (Core.Now <= HolidaySettings.FinishHalloween)
|
||||
{
|
||||
m_ClearTimer.Stop();
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ namespace Server.Engines.Events
|
|||
{
|
||||
PlayerMobile player = null;
|
||||
|
||||
if (DateTime.UtcNow <= HolidaySettings.FinishHalloween)
|
||||
if (Core.Now <= HolidaySettings.FinishHalloween)
|
||||
{
|
||||
for (var index = 0; m_DeathQueue.Count > 0 && index < m_DeathQueue.Count; index++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace Server.Items
|
|||
|
||||
public bool IsSigned => m_Line1 != null || m_Line2 != null || m_Line3 != null;
|
||||
|
||||
public bool CanSign => !IsSigned || DateTime.UtcNow <= EditLimit;
|
||||
public bool CanSign => !IsSigned || Core.Now <= EditLimit;
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
|
|
@ -237,7 +237,7 @@ namespace Server.Items
|
|||
|
||||
if (!m_Bear.IsSigned)
|
||||
{
|
||||
m_Bear.EditLimit = DateTime.UtcNow + TimeSpan.FromMinutes(10);
|
||||
m_Bear.EditLimit = Core.Now + TimeSpan.FromMinutes(10);
|
||||
}
|
||||
|
||||
m_Bear.Line1 = Utility.FixHtml(line1);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace Server.Items
|
|||
|
||||
public static bool CheckSeason(Mobile from)
|
||||
{
|
||||
if (DateTime.UtcNow.Month == 2)
|
||||
if (Core.Now.Month == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue