diff --git a/src/Stopwatch_TEST.cc b/src/Stopwatch_TEST.cc index e51e2a03..22846a3b 100644 --- a/src/Stopwatch_TEST.cc +++ b/src/Stopwatch_TEST.cc @@ -155,6 +155,9 @@ TEST(Stopwatch, StartStopReset) watch.Start(true); EXPECT_TRUE(watch.Running()); EXPECT_LT(watch.StopTime(), watch.StartTime()); + // Add a small sleep to make sure that there's is some time elapsed between + // calling Start(true) above and ElapsedRunTime() below. + std::this_thread::sleep_for(std::chrono::microseconds(1)); EXPECT_NE(steady_clock::duration::zero(), watch.ElapsedRunTime()); EXPECT_EQ(steady_clock::duration::zero(), watch.ElapsedStopTime()); }