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

@ -94,7 +94,7 @@ namespace Server.Mobiles
{
SayTo(pm, 501046); // Thou must resign from thy other guild first.
}
else if (pm.GameTime < JoinGameAge || pm.CreationTime + JoinAge > DateTime.UtcNow)
else if (pm.GameTime < JoinGameAge || pm.CreationTime + JoinAge > Core.Now)
{
SayTo(pm, 501048); // You are too young to join my guild...
}
@ -111,7 +111,7 @@ namespace Server.Mobiles
{
SayTo(pm, 501052); // Thou dost not belong to my guild!
}
else if (pm.NpcGuildJoinTime + QuitAge > DateTime.UtcNow ||
else if (pm.NpcGuildJoinTime + QuitAge > Core.Now ||
pm.NpcGuildGameTime + QuitGameAge > pm.GameTime)
{
SayTo(pm, 501053); // You just joined my guild! You must wait a week to resign.
@ -141,7 +141,7 @@ namespace Server.Mobiles
{
SayTo(pm, 501046); // Thou must resign from thy other guild first.
}
else if (pm.GameTime < JoinGameAge || pm.CreationTime + JoinAge > DateTime.UtcNow)
else if (pm.GameTime < JoinGameAge || pm.CreationTime + JoinAge > Core.Now)
{
SayTo(pm, 501048); // You are too young to join my guild...
}
@ -150,7 +150,7 @@ namespace Server.Mobiles
SayWelcomeTo(pm);
pm.NpcGuild = NpcGuild;
pm.NpcGuildJoinTime = DateTime.UtcNow;
pm.NpcGuildJoinTime = Core.Now;
pm.NpcGuildGameTime = pm.GameTime;
dropped.Delete();