From d11c3807b32d51e48ed4557972a627f6366956d9 Mon Sep 17 00:00:00 2001 From: Treeston Date: Tue, 14 Jul 2020 01:35:25 +0200 Subject: Core/Time: Rename GetGameTime{System, Steady}Point methods The names are a bit unhandy. Rename them (shorter but still meaningful). GetGameTimeSystemPoint() -> GetSystemTime() GetGameTimeSteadyPoint() -> Now() Also add 2 new typedefs: typedef std::chrono::steady_clock::time_point TimePoint; typedef std::chrono::system_clock::time_point SystemTimePoint; Closes #25042 (cherry picked from commit 896b68d5c297b06587645caebc98b704978ecaa7) --- src/common/Metric/Metric.h | 4 ++-- src/common/Utilities/Duration.h | 4 ++++ src/common/Utilities/Timer.h | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/common') diff --git a/src/common/Metric/Metric.h b/src/common/Metric/Metric.h index d46e0566130..5e843139354 100644 --- a/src/common/Metric/Metric.h +++ b/src/common/Metric/Metric.h @@ -19,8 +19,8 @@ #define METRIC_H__ #include "Define.h" +#include "Duration.h" #include "MPSCQueue.h" -#include #include #include #include @@ -48,7 +48,7 @@ typedef std::pair MetricTag; struct MetricData { std::string Category; - std::chrono::system_clock::time_point Timestamp; + SystemTimePoint Timestamp; MetricDataType Type; std::vector Tags; diff --git a/src/common/Utilities/Duration.h b/src/common/Utilities/Duration.h index ca71902bc6f..7eb349e6d85 100644 --- a/src/common/Utilities/Duration.h +++ b/src/common/Utilities/Duration.h @@ -32,6 +32,10 @@ typedef std::chrono::minutes Minutes; /// Hours shorthand typedef. typedef std::chrono::hours Hours; +/// time_point shorthand typedefs +typedef std::chrono::steady_clock::time_point TimePoint; +typedef std::chrono::system_clock::time_point SystemTimePoint; + /// Makes std::chrono_literals globally available. using namespace std::chrono_literals; diff --git a/src/common/Utilities/Timer.h b/src/common/Utilities/Timer.h index 4abd6cc8ca1..a197c5cfbb4 100644 --- a/src/common/Utilities/Timer.h +++ b/src/common/Utilities/Timer.h @@ -19,9 +19,9 @@ #define TRINITY_TIMER_H #include "Define.h" -#include +#include "Duration.h" -inline std::chrono::steady_clock::time_point GetApplicationStartTime() +inline TimePoint GetApplicationStartTime() { using namespace std::chrono; @@ -46,7 +46,7 @@ inline uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime) return newMSTime - oldMSTime; } -inline uint32 getMSTimeDiff(uint32 oldMSTime, std::chrono::steady_clock::time_point newTime) +inline uint32 getMSTimeDiff(uint32 oldMSTime, TimePoint newTime) { using namespace std::chrono; -- cgit v1.2.3