diff options
| author | Phil Nash | 2017-08-04 12:16:05 +0100 |
|---|---|---|
| committer | Phil Nash | 2017-08-04 12:16:05 +0100 |
| commit | c7028f7bc76e011f23fcc2baf308f5c27ef1f019 (patch) | |
| tree | af95773ab925edba6023019e9f23617d9a759078 /include/internal/catch_timer.cpp | |
| parent | 5450de2acd296e7c4b25e2c738f1d4f7199161b4 (diff) | |
| download | catch3-c7028f7bc76e011f23fcc2baf308f5c27ef1f019.tar.gz | |
Made most of Timer class inline - and export getCurrentMicrosecondsSinceEpoch()
Diffstat (limited to 'include/internal/catch_timer.cpp')
| -rw-r--r-- | include/internal/catch_timer.cpp | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/include/internal/catch_timer.cpp b/include/internal/catch_timer.cpp index d4066fa9..3253f1f4 100644 --- a/include/internal/catch_timer.cpp +++ b/include/internal/catch_timer.cpp @@ -12,23 +12,8 @@ namespace Catch { - namespace { - uint64_t getCurrentMicrosecondsSinceEpoch() { - return std::chrono::duration_cast<std::chrono::microseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count(); - } - } - - void Timer::start() { - m_microSeconds = getCurrentMicrosecondsSinceEpoch(); - } - unsigned int Timer::getElapsedMicroseconds() const { - return static_cast<unsigned int>(getCurrentMicrosecondsSinceEpoch() - m_microSeconds); - } - unsigned int Timer::getElapsedMilliseconds() const { - return static_cast<unsigned int>(getElapsedMicroseconds()/1000); - } - double Timer::getElapsedSeconds() const { - return getElapsedMicroseconds()/1000000.0; + auto getCurrentMicrosecondsSinceEpoch() -> uint64_t { + return std::chrono::duration_cast<std::chrono::microseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count(); } } // namespace Catch |