Skip to content

Commit

Permalink
qt: update rounding method for displaying playback time
Browse files Browse the repository at this point in the history
  • Loading branch information
chubinou authored and robUx4 committed Jun 27, 2024
1 parent d1482d8 commit a59d3f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions modules/gui/qt/util/vlctick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions modules/gui/qt/util/vlctick.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit a59d3f9

Please sign in to comment.