aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/vcpkg_Chrono.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'toolsrc/src/vcpkg_Chrono.cpp')
-rw-r--r--toolsrc/src/vcpkg_Chrono.cpp56
1 files changed, 0 insertions, 56 deletions
diff --git a/toolsrc/src/vcpkg_Chrono.cpp b/toolsrc/src/vcpkg_Chrono.cpp
index 1bcb439be..e39842df9 100644
--- a/toolsrc/src/vcpkg_Chrono.cpp
+++ b/toolsrc/src/vcpkg_Chrono.cpp
@@ -60,60 +60,4 @@ namespace vcpkg
{
return format_time_userfriendly(elapsed<std::chrono::nanoseconds>());
}
-
- Stopwatch Stopwatch::createUnstarted()
- {
- return Stopwatch();
- }
-
- Stopwatch Stopwatch::createStarted()
- {
- return Stopwatch().start();
- }
-
- bool Stopwatch::isRunning() const
- {
- return this->m_isRunning;
- }
-
- const Stopwatch& Stopwatch::start()
- {
- Checks::check_exit(!this->m_isRunning, "This stopwatch is already running.");
- this->m_isRunning = true;
- this->m_startTick = std::chrono::high_resolution_clock::now();
- return *this;
- }
-
- const Stopwatch& Stopwatch::stop()
- {
- auto tick = std::chrono::high_resolution_clock::now();
- Checks::check_exit(this->m_isRunning, "This stopwatch is already stopped.");
- this->m_isRunning = false;
- this->m_elapsedNanos += tick - this->m_startTick;
- return *this;
- }
-
- Stopwatch& Stopwatch::reset()
- {
- this->m_elapsedNanos = std::chrono::nanoseconds();
- this->m_isRunning = false;
- return *this;
- }
-
- std::string Stopwatch::toString() const
- {
- return format_time_userfriendly(this->elapsedNanos());
- }
-
- Stopwatch::Stopwatch() : m_isRunning(false), m_elapsedNanos(0), m_startTick() { }
-
- std::chrono::nanoseconds Stopwatch::elapsedNanos() const
- {
- if (this->m_isRunning)
- {
- return std::chrono::high_resolution_clock::now() - this->m_startTick + this->m_elapsedNanos;
- }
-
- return this->m_elapsedNanos;
- }
}