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
|
|
@ -171,7 +171,7 @@ namespace Server.Spells.Spellweaving
|
|||
{
|
||||
to.SendLocalizedMessage(1072828); // Your arcane focus is renewed.
|
||||
focus.LifeSpan = duration;
|
||||
focus.CreationTime = DateTime.UtcNow;
|
||||
focus.CreationTime = Core.Now;
|
||||
focus.StrengthBonus = strengthBonus;
|
||||
focus.InvalidateProperties();
|
||||
focus.SendTimeRemainingMessage(to);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Server.Items
|
|||
public TransientItem(int itemID, TimeSpan lifeSpan)
|
||||
: base(itemID)
|
||||
{
|
||||
CreationTime = DateTime.UtcNow;
|
||||
CreationTime = Core.Now;
|
||||
LifeSpan = lifeSpan;
|
||||
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5), CheckExpiry);
|
||||
|
|
@ -67,7 +67,7 @@ namespace Server.Items
|
|||
|
||||
public virtual void CheckExpiry()
|
||||
{
|
||||
if (CreationTime + LifeSpan < DateTime.UtcNow)
|
||||
if (CreationTime + LifeSpan < Core.Now)
|
||||
{
|
||||
Expire(RootParent as Mobile);
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ namespace Server.Items
|
|||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
var remaining = CreationTime + LifeSpan - DateTime.UtcNow;
|
||||
var remaining = CreationTime + LifeSpan - Core.Now;
|
||||
|
||||
list.Add(1072517, ((int)remaining.TotalSeconds).ToString()); // Lifespan: ~1_val~ seconds
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue