From 7713c7e607b11c0828decdbf35d910280153f880 Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Sat, 30 Sep 2017 18:00:34 +0200 Subject: Use helper function dive_endtime() where apropriate Calculating dive.when + dive.duration doesn't always give the correct endtime of a dive especially when a dive has surface interval(s) in the middle. Using the helper function dive_endtime() fixes this issue. Signed-off-by: Stefan Fuchs --- desktop-widgets/tab-widgets/TabDiveInformation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'desktop-widgets/tab-widgets') diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp index 419e73739..ae3998ed8 100644 --- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp +++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp @@ -6,6 +6,7 @@ #include #include #include +#include TabDiveInformation::TabDiveInformation(QWidget *parent) : TabBase(parent), ui(new Ui::TabDiveInformation()) { @@ -81,7 +82,7 @@ void TabDiveInformation::updateData() process_all_dives(&displayed_dive, &prevd); if (prevd) - ui->surfaceIntervalText->setText(get_dive_surfint_string(displayed_dive.when - (prevd->when + prevd->duration.seconds), tr("d"), tr("h"), tr("min"))); + ui->surfaceIntervalText->setText(get_dive_surfint_string(displayed_dive.when - (dive_endtime(prevd)), tr("d"), tr("h"), tr("min"))); else ui->surfaceIntervalText->clear(); -- cgit v1.2.3-70-g09d2