diff --git a/src/test/performancetimer_test.cpp b/src/test/performancetimer_test.cpp index 183e688cbbed..77df8deb266c 100644 --- a/src/test/performancetimer_test.cpp +++ b/src/test/performancetimer_test.cpp @@ -23,6 +23,8 @@ TEST(PerformanceTimerTest, DifferenceCanBeNegative) { late.start(); mixxx::Duration difference = early.difference(late); + qWarning() << early.elapsed() << late.elapsed() << difference; + // If the high-res clock hasn't ticked yet, the difference should be 0. // If it has ticked, then the difference better be negative. ASSERT_LE(difference.toIntegerNanos(), 0); diff --git a/src/util/performancetimer.h b/src/util/performancetimer.h index 8d0286667a52..81e751b52ca5 100644 --- a/src/util/performancetimer.h +++ b/src/util/performancetimer.h @@ -28,9 +28,9 @@ class PerformanceTimer { m_elapsedTimer.restart(); return elapsedNs; } - + // only provides milliseconds resolution, Qt (possibly API) limitation mixxx::Duration difference(const PerformanceTimer& timer) const { - return timer.elapsed() - elapsed(); + return mixxx::Duration::fromMillis(m_elapsedTimer.msecsTo(timer.m_elapsedTimer)); } bool running() const {