summaryrefslogtreecommitdiffstats
path: root/qt-ui/models.cpp
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2014-10-30 09:49:05 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-30 10:13:44 -0700
commitca8fc978d2efead9cbfd82fccbe4d56117b3edab (patch)
treedae4d62213d39d8751ccbf62d705c34f9dc9dc18 /qt-ui/models.cpp
parent0996908dd8eb4e630f32529212cd54fa2cc3c35d (diff)
downloadsubsurface-ca8fc978d2efead9cbfd82fccbe4d56117b3edab.tar.gz
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>
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r--qt-ui/models.cpp10
1 files 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;
}