From 6a6ce67a581338a9c5ac095c0ca026b7d554882c Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 4 Nov 2018 17:22:33 +0200 Subject: [PATCH] Fixed: Displaying song playtime --HG-- branch : develop --- code/ryzom/client/src/interface_v3/music_player.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/music_player.cpp b/code/ryzom/client/src/interface_v3/music_player.cpp index c49757681..0670c2935 100644 --- a/code/ryzom/client/src/interface_v3/music_player.cpp +++ b/code/ryzom/client/src/interface_v3/music_player.cpp @@ -284,8 +284,13 @@ void CMusicPlayer::update () if (pVT) { TTime dur = (CTime::getLocalTime() - _PlayStart) / 1000; - std::string title; - title = toString("%02d:%02d %s", dur / 60, dur % 60, _CurrentSong.Title.c_str()); + uint min = (dur / 60) % 60; + uint sec = dur % 60; + uint hour = dur / 3600; + + std::string title(toString("%02d:%02d", min, sec)); + if (hour > 0) title = toString("%02d:", hour) + title; + title += " " + _CurrentSong.Title; pVT->setText(ucstring::makeFromUtf8(title)); }