From df7248039553b3ebd338380c3ef0428b0e046e79 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 14 Aug 2020 09:38:45 -0400 Subject: common: Make use of [[nodiscard]] where applicable Now that clang-format makes [[nodiscard]] attributes format sensibly, we can apply them to several functions within the common library to allow the compiler to complain about any misuses of the functions. --- src/common/timer.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/common/timer.h') diff --git a/src/common/timer.h b/src/common/timer.h index 27b521baa..8894a143d 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -19,18 +19,18 @@ public: // The time difference is always returned in milliseconds, regardless of alternative internal // representation - std::chrono::milliseconds GetTimeDifference(); + [[nodiscard]] std::chrono::milliseconds GetTimeDifference(); void AddTimeDifference(); - static std::chrono::seconds GetTimeSinceJan1970(); - static std::chrono::seconds GetLocalTimeSinceJan1970(); - static double GetDoubleTime(); + [[nodiscard]] static std::chrono::seconds GetTimeSinceJan1970(); + [[nodiscard]] static std::chrono::seconds GetLocalTimeSinceJan1970(); + [[nodiscard]] static double GetDoubleTime(); - static std::string GetTimeFormatted(); - std::string GetTimeElapsedFormatted() const; - std::chrono::milliseconds GetTimeElapsed(); + [[nodiscard]] static std::string GetTimeFormatted(); + [[nodiscard]] std::string GetTimeElapsedFormatted() const; + [[nodiscard]] std::chrono::milliseconds GetTimeElapsed(); - static std::chrono::milliseconds GetTimeMs(); + [[nodiscard]] static std::chrono::milliseconds GetTimeMs(); private: std::chrono::milliseconds m_LastTime; -- cgit v1.2.3