diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/Collision/DynamicTree.cpp | 2 | ||||
-rw-r--r-- | src/common/Utilities/Timer.h | 60 |
2 files changed, 11 insertions, 51 deletions
diff --git a/src/common/Collision/DynamicTree.cpp b/src/common/Collision/DynamicTree.cpp index bd7034bbb6c..c7e3d4b4ed0 100644 --- a/src/common/Collision/DynamicTree.cpp +++ b/src/common/Collision/DynamicTree.cpp @@ -103,7 +103,7 @@ struct DynTreeImpl : public ParentTree/*, public Intersectable*/ } } - TimeTrackerSmall rebalance_timer; + TimeTracker rebalance_timer; int unbalanced_times; }; 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 |