diff --git a/test/benchmark_test.cc b/test/benchmark_test.cc index fa995590..252602a7 100644 --- a/test/benchmark_test.cc +++ b/test/benchmark_test.cc @@ -186,7 +186,8 @@ static void BM_ManualTiming(benchmark::State& state) { while (state.KeepRunning()) { auto start = std::chrono::high_resolution_clock::now(); // Simulate some useful workload with a sleep - std::this_thread::sleep_for(sleep_duration); + std::this_thread::sleep_for(std::chrono::duration_cast< + std::chrono::nanoseconds>(sleep_duration)); auto end = std::chrono::high_resolution_clock::now(); auto elapsed = diff --git a/test/options_test.cc b/test/options_test.cc index 4fe2d17a..4737caa2 100644 --- a/test/options_test.cc +++ b/test/options_test.cc @@ -9,14 +9,11 @@ void BM_basic(benchmark::State& state) { } void BM_basic_slow(benchmark::State& state) { - - int milliseconds = state.range_x(); - std::chrono::duration sleep_duration { - static_cast(milliseconds) - }; - + std::chrono::milliseconds sleep_duration(state.range_x()); while (state.KeepRunning()) { - std::this_thread::sleep_for(sleep_duration); + std::this_thread::sleep_for( + std::chrono::duration_cast(sleep_duration) + ); } }