diff options
author | Carbenium <carbenium@outlook.com> | 2020-07-29 00:16:15 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-01-24 21:34:36 +0100 |
commit | 8809d54ca2daa230b1439f012c8b10ee88d6beae (patch) | |
tree | c5d209bcf4d7c5b231f113cc1d08dd6b3c05184a /src/common/Utilities/Timer.h | |
parent | 35e0002df3073cf4c3e1dae9fbff73d75ddb5e98 (diff) |
Core/Common: Merge TimeTrackerSmall with TimeTracker
(cherry picked from commit 228696bf80bcd55d35445cd24ae119020c310f88)
Diffstat (limited to 'src/common/Utilities/Timer.h')
-rw-r--r-- | src/common/Utilities/Timer.h | 60 |
1 files changed, 10 insertions, 50 deletions
diff --git a/src/common/Utilities/Timer.h b/src/common/Utilities/Timer.h index 1af967f886a..e0ecb5b2d13 100644 --- a/src/common/Utilities/Timer.h +++ b/src/common/Utilities/Timer.h @@ -115,81 +115,41 @@ private: struct TimeTracker { public: - - TimeTracker(time_t expiry) - : i_expiryTime(expiry) - { - } - - void Update(time_t diff) - { - i_expiryTime -= diff; - } - - bool Passed() const - { - return i_expiryTime <= 0; - } - - void Reset(time_t interval) - { - i_expiryTime = interval; - } - - time_t GetExpiry() const - { - return i_expiryTime; - } - -private: - - time_t i_expiryTime; -}; - -struct TimeTrackerSmall -{ -public: - - TimeTrackerSmall(int32 expiry = 0) - : i_expiryTime(expiry) - { - } - - TimeTrackerSmall(Milliseconds expiry) : i_expiryTime(expiry.count()) { } + TimeTracker(int32 expiry = 0) : _expiryTime(expiry) { } + TimeTracker(Milliseconds expiry) : _expiryTime(expiry) { } void Update(int32 diff) { - i_expiryTime -= diff; + Update(Milliseconds(diff)); } void Update(Milliseconds diff) { - Update(diff.count()); + _expiryTime -= diff; } bool Passed() const { - return i_expiryTime <= 0; + return _expiryTime <= 0s; } - void Reset(int32 interval) + void Reset(int32 expiry) { - i_expiryTime = interval; + Reset(Milliseconds(expiry)); } void Reset(Milliseconds expiry) { - Reset(expiry.count()); + _expiryTime = expiry; } Milliseconds GetExpiry() const { - return Milliseconds(i_expiryTime); + return _expiryTime; } private: - - int32 i_expiryTime; + Milliseconds _expiryTime; }; struct PeriodicTimer |