From a59d3f9dd511301b822bd3368ec1bdce9462b809 Mon Sep 17 00:00:00 2001 From: Pierre Lamot Date: Tue, 25 Jun 2024 16:24:10 +0200 Subject: [PATCH] qt: update rounding method for displaying playback time --- modules/gui/qt/util/vlctick.cpp | 3 +-- modules/gui/qt/util/vlctick.hpp | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/gui/qt/util/vlctick.cpp b/modules/gui/qt/util/vlctick.cpp index b8b73d04848f..047909ccf2cc 100644 --- a/modules/gui/qt/util/vlctick.cpp +++ b/modules/gui/qt/util/vlctick.cpp @@ -58,8 +58,7 @@ QString VLCTick::formatHMS() const int64_t t_ms = MS_FROM_VLC_TICK(m_ticks); if (t_ms >= 1000) { - //round to the nearest second - t_ms = roundNearestMultiple(t_ms, 1000); + //truncate milliseconds toward 0 int64_t t_sec = t_ms / 1000; int sec = t_sec % 60; int min = (t_sec / 60) % 60; diff --git a/modules/gui/qt/util/vlctick.hpp b/modules/gui/qt/util/vlctick.hpp index 43c272e26780..4fcb36bf4326 100644 --- a/modules/gui/qt/util/vlctick.hpp +++ b/modules/gui/qt/util/vlctick.hpp @@ -40,6 +40,11 @@ class VLCTick /** * @brief formatHMS * @return time as HH:MM:SS + * + * this method should be used to present running time or + * time that will be compared to a running time + * + * milliseconds will be truncated towards 0 */ Q_INVOKABLE QString formatHMS() const;