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:
Kamron Batman 2021-03-13 01:32:04 -08:00 • committed by GitHub
parent 5de6edbeb8
commit 6c4308bce6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
208 changed files with 660 additions and 793 deletions

View file

@ -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);

View file

@ -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;
}