From 7847589d9ca35de80dce68ac5cf5cf42c77b39a4 Mon Sep 17 00:00:00 2001 From: Carbenium Date: Wed, 22 Jul 2020 00:19:33 +0200 Subject: EventMap: Switch internal timer over to std::chrono type Adds the EventMap::Update(Milliseconds time) overload (cherry picked from commit b9795e44824c7cab58445e4a72d2113ddb451caa) --- src/common/Utilities/EventMap.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/common/Utilities/EventMap.h') diff --git a/src/common/Utilities/EventMap.h b/src/common/Utilities/EventMap.h index 820e7539649..8d69524f2be 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 EventStore; + typedef std::multimap EventStore; public: - EventMap() : _time(0), _phase(0), _lastEvent(0) { } + EventMap() : _time(TimePoint::min()), _phase(0), _lastEvent(0) { } /** * @name Reset @@ -52,6 +52,16 @@ public: * @param time Value in ms to be added to time. */ 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 -- cgit v1.2.3