diff options
author | Carbenium <carbenium@outlook.com> | 2020-07-22 00:19:33 +0200 |
---|---|---|
committer | Peter Keresztes Schmidt <carbenium@outlook.com> | 2020-07-26 23:20:11 +0200 |
commit | b9795e44824c7cab58445e4a72d2113ddb451caa (patch) | |
tree | b1cd874227415a966c30be67d34c913159405826 /src/common/Utilities/EventMap.h | |
parent | 40efda9726dce4fc6f432852f8d41bee606872b7 (diff) |
EventMap: Switch internal timer over to std::chrono type
Adds the EventMap::Update(Milliseconds time) overload
Diffstat (limited to 'src/common/Utilities/EventMap.h')
-rw-r--r-- | src/common/Utilities/EventMap.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/common/Utilities/EventMap.h b/src/common/Utilities/EventMap.h index a9f864267f9..dbb297a1c63 100644 --- a/src/common/Utilities/EventMap.h +++ b/src/common/Utilities/EventMap.h @@ -26,7 +26,7 @@ class TC_COMMON_API EventMap { /** * Internal storage type. - * Key: Time as uint32 when the event should occur. + * Key: Time as TimePoint when the event should occur. * Value: The event data as uint32. * * Structure of event data: @@ -35,10 +35,10 @@ class TC_COMMON_API EventMap * - Bit 24 - 31: Phase * - Pattern: 0xPPGGEEEE */ - typedef std::multimap<uint32, uint32> EventStore; + typedef std::multimap<TimePoint, uint32> EventStore; public: - EventMap() : _time(0), _phase(0), _lastEvent(0) { } + EventMap() : _time(TimePoint::min()), _phase(0), _lastEvent(0) { } /** * @name Reset @@ -53,6 +53,16 @@ public: */ void Update(uint32 time) { + Update(Milliseconds(time)); + } + + /** + * @name Update + * @brief Updates the timer of the event map. + * @param time Value in ms to be added to time. + */ + void Update(Milliseconds time) + { _time += time; } @@ -226,7 +236,7 @@ private: * has reached their time value. Its value is changed in the * Update method. */ - uint32 _time; + TimePoint _time; /** * @name _phase |