Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Changed clock resolution estimator to return uint64_t

Commit
97d6b08087b4afd335bfacfda0537581f6ef3f9b
Author
Phil Nash ·
Parents
a9b6813ad9e4

Files · Download .tar.gz

Changes

 include/internal/catch_timer.cpp | 6 +++---
 include/internal/catch_timer.h   | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/internal/catch_timer.cpp b/include/internal/catch_timer.cpp
index 9635ccea..ec1d8bb5 100644
--- a/include/internal/catch_timer.cpp
+++ b/include/internal/catch_timer.cpp
@@ -16,7 +16,7 @@ namespace Catch {
         return std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();
     }
 
-    auto estimateClockResolution() -> double {
+    auto estimateClockResolution() -> uint64_t {
         uint64_t sum = 0;
         static const uint64_t iterations = 1000000;
 
@@ -35,9 +35,9 @@ namespace Catch {
 
         // We're just taking the mean, here. To do better we could take the std. dev and exclude outliers
         // - and potentially do more iterations if there's a high variance.
-        return sum/(double)iterations;
+        return sum/iterations;
     }
-    auto getEstimatedClockResolution() -> double {
+    auto getEstimatedClockResolution() -> uint64_t {
         static auto s_resolution = estimateClockResolution();
         return s_resolution;
     }
diff --git a/include/internal/catch_timer.h b/include/internal/catch_timer.h
index 1871c24a..e01a1cb7 100644
--- a/include/internal/catch_timer.h
+++ b/include/internal/catch_timer.h
@@ -13,7 +13,7 @@
 namespace Catch {
 
     auto getCurrentNanosecondsSinceEpoch() -> uint64_t;
-    auto getEstimatedClockResolution() -> double;
+    auto getEstimatedClockResolution() -> uint64_t;
 
     class Timer {
         uint64_t m_nanoseconds = 0;