diff --git a/Source/Framework/Util/Time.cs b/Source/Framework/Util/Time.cs index 772e7d48e..2af585e1a 100644 --- a/Source/Framework/Util/Time.cs +++ b/Source/Framework/Util/Time.cs @@ -346,11 +346,21 @@ public class TimeTrackerSmall i_expiryTime = expiry; } + public TimeTrackerSmall(TimeSpan expiry = default) + { + i_expiryTime = (int)expiry.TotalMilliseconds; + } + public void Update(int diff) { i_expiryTime -= diff; } + public void Update(TimeSpan diff) + { + Update((int)diff.TotalMilliseconds); + } + public bool Passed() { return i_expiryTime <= 0; @@ -361,10 +371,16 @@ public class TimeTrackerSmall i_expiryTime = interval; } - public int GetExpiry() + public void Reset(TimeSpan expiry) { - return i_expiryTime; + Reset((int)expiry.TotalMilliseconds); } + + public TimeSpan GetExpiry() + { + return TimeSpan.FromMilliseconds(i_expiryTime); + } + int i_expiryTime; }