Fixed: Displaying song playtime

--HG--
branch : develop
This commit is contained in:
Nimetu 2018-11-04 17:22:33 +02:00
parent 6c8e42361a
commit 6a6ce67a58

View file

@ -284,8 +284,13 @@ void CMusicPlayer::update ()
if (pVT) if (pVT)
{ {
TTime dur = (CTime::getLocalTime() - _PlayStart) / 1000; TTime dur = (CTime::getLocalTime() - _PlayStart) / 1000;
std::string title; uint min = (dur / 60) % 60;
title = toString("%02d:%02d %s", dur / 60, dur % 60, _CurrentSong.Title.c_str()); 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)); pVT->setText(ucstring::makeFromUtf8(title));
} }