From e16084cc8d15b0c042871b0d1cffa6320a1681d4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 16:32:14 -0800 Subject: Rename Stopwatch.h/cpp to vcpkg_Chrono.h/cpp --- toolsrc/include/Stopwatch.h | 59 ------------------------------------------ toolsrc/include/vcpkg_Chrono.h | 59 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 59 deletions(-) delete mode 100644 toolsrc/include/Stopwatch.h create mode 100644 toolsrc/include/vcpkg_Chrono.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/Stopwatch.h b/toolsrc/include/Stopwatch.h deleted file mode 100644 index e4ae121b3..000000000 --- a/toolsrc/include/Stopwatch.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#include -#include - -namespace vcpkg -{ - class ElapsedTime - { - public: - static ElapsedTime createStarted(); - - constexpr ElapsedTime() :m_startTick() {} - - template - TimeUnit elapsed() const - { - return std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - this->m_startTick); - } - - std::string toString() const; - - private: - std::chrono::steady_clock::time_point m_startTick; - }; - - class Stopwatch - { - public: - static Stopwatch createUnstarted(); - - static Stopwatch createStarted(); - - bool isRunning() const; - - const Stopwatch& start(); - - const Stopwatch& stop(); - - Stopwatch& reset(); - - template - TimeUnit elapsed() const - { - return std::chrono::duration_cast(elapsedNanos()); - } - - std::string toString() const; - - private: - Stopwatch(); - - std::chrono::nanoseconds elapsedNanos() const; - - bool m_isRunning; - std::chrono::nanoseconds m_elapsedNanos; - std::chrono::steady_clock::time_point m_startTick; - }; -} diff --git a/toolsrc/include/vcpkg_Chrono.h b/toolsrc/include/vcpkg_Chrono.h new file mode 100644 index 000000000..e4ae121b3 --- /dev/null +++ b/toolsrc/include/vcpkg_Chrono.h @@ -0,0 +1,59 @@ +#pragma once + +#include +#include + +namespace vcpkg +{ + class ElapsedTime + { + public: + static ElapsedTime createStarted(); + + constexpr ElapsedTime() :m_startTick() {} + + template + TimeUnit elapsed() const + { + return std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - this->m_startTick); + } + + std::string toString() const; + + private: + std::chrono::steady_clock::time_point m_startTick; + }; + + class Stopwatch + { + public: + static Stopwatch createUnstarted(); + + static Stopwatch createStarted(); + + bool isRunning() const; + + const Stopwatch& start(); + + const Stopwatch& stop(); + + Stopwatch& reset(); + + template + TimeUnit elapsed() const + { + return std::chrono::duration_cast(elapsedNanos()); + } + + std::string toString() const; + + private: + Stopwatch(); + + std::chrono::nanoseconds elapsedNanos() const; + + bool m_isRunning; + std::chrono::nanoseconds m_elapsedNanos; + std::chrono::steady_clock::time_point m_startTick; + }; +} -- cgit v1.2.3