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
|
|
@ -185,7 +185,7 @@ namespace Server.Gumps
|
|||
AddLabel(150, 270, LabelHue, Core.ScriptItems.ToString());
|
||||
|
||||
AddLabel(20, 290, LabelHue, "Uptime:");
|
||||
AddLabel(150, 290, LabelHue, FormatTimeSpan(DateTime.UtcNow - Clock.ServerStart));
|
||||
AddLabel(150, 290, LabelHue, FormatTimeSpan(Core.Now - Clock.ServerStart));
|
||||
|
||||
AddLabel(20, 310, LabelHue, "Memory:");
|
||||
AddLabel(150, 310, LabelHue, FormatByteAmount(GC.GetTotalMemory(false)));
|
||||
|
|
@ -902,17 +902,7 @@ namespace Server.Gumps
|
|||
}
|
||||
else
|
||||
{
|
||||
var remaining = DateTime.UtcNow - banTime;
|
||||
|
||||
if (remaining < TimeSpan.Zero)
|
||||
{
|
||||
remaining = TimeSpan.Zero;
|
||||
}
|
||||
else if (remaining > banDuration)
|
||||
{
|
||||
remaining = banDuration;
|
||||
}
|
||||
|
||||
var remaining = (Core.Now - banTime).Clamp(TimeSpan.Zero, banDuration);
|
||||
var remMinutes = remaining.TotalMinutes;
|
||||
var totMinutes = banDuration.TotalMinutes;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue