From ca8fc978d2efead9cbfd82fccbe4d56117b3edab Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 30 Oct 2014 09:49:05 -0700 Subject: [PATCH] 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 Signed-off-by: Dirk Hohndel --- qt-ui/models.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 1e41dc173..bf1c6a6de 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -1324,19 +1324,17 @@ QString DiveItem::displayDepthWithUnit() const QString DiveItem::displayDuration() const { - int hrs, mins, secs; + int hrs, mins; struct dive *dive = get_dive_by_uniq_id(diveId); - secs = dive->duration.seconds % 60; - mins = dive->duration.seconds / 60; + mins = (dive->duration.seconds+59) / 60; hrs = mins / 60; mins -= hrs * 60; QString displayTime; 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 - displayTime = QString("%1:").arg(mins); - displayTime += QString("%1").arg(secs, 2, 10, QChar('0')); + displayTime = QString("%1").arg(mins); return displayTime; }