Display dive duration in dive list in whole minutes

The whole "duration in seconds" is being way too OCD about the
information, and just makes it harder to read.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2014-10-30 09:49:05 -07:00 committed by Dirk Hohndel
parent 0996908dd8
commit ca8fc978d2

View file

@ -1324,19 +1324,17 @@ QString DiveItem::displayDepthWithUnit() const
QString DiveItem::displayDuration() const QString DiveItem::displayDuration() const
{ {
int hrs, mins, secs; int hrs, mins;
struct dive *dive = get_dive_by_uniq_id(diveId); struct dive *dive = get_dive_by_uniq_id(diveId);
secs = dive->duration.seconds % 60; mins = (dive->duration.seconds+59) / 60;
mins = dive->duration.seconds / 60;
hrs = mins / 60; hrs = mins / 60;
mins -= hrs * 60; mins -= hrs * 60;
QString displayTime; QString displayTime;
if (hrs) if (hrs)
displayTime = QString("%1:%2:").arg(hrs).arg(mins, 2, 10, QChar('0')); displayTime = QString("%1:%2").arg(hrs).arg(mins, 2, 10, QChar('0'));
else else
displayTime = QString("%1:").arg(mins); displayTime = QString("%1").arg(mins);
displayTime += QString("%1").arg(secs, 2, 10, QChar('0'));
return displayTime; return displayTime;
} }