aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/mainwindow.cpp2
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp14
2 files changed, 3 insertions, 13 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index b3f474de8..94c51279f 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -865,7 +865,7 @@ void MainWindow::on_actionReplanDive_triggered()
graphics->clearHandlers();
setApplicationState(ApplicationState::PlanDive);
divePlannerWidget->setReplanButton(true);
- divePlannerWidget->setupStartTime(QDateTime::fromMSecsSinceEpoch(1000 * current_dive->when, Qt::UTC));
+ divePlannerWidget->setupStartTime(timestampToDateTime(current_dive->when));
if (current_dive->surface_pressure.mbar)
divePlannerWidget->setSurfacePressure(current_dive->surface_pressure.mbar);
if (current_dive->salinity)
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index d11581516..81c56a486 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -307,14 +307,6 @@ void MainTab::updateNotes(const struct dive *d)
}
}
-static QDateTime timestampToDateTime(timestamp_t when)
-{
- // Subsurface always uses "local time" as in "whatever was the local time at the location"
- // so all time stamps have no time zone information and are in UTC
- QDateTime localTime = QDateTime::fromMSecsSinceEpoch(1000 * when, Qt::UTC);
- localTime.setTimeSpec(Qt::UTC);
- return localTime;
-}
void MainTab::updateDateTime(const struct dive *d)
{
QDateTime localTime = timestampToDateTime(d->when);
@@ -617,8 +609,7 @@ void MainTab::on_dateEdit_editingFinished()
{
if (ignoreInput || !current_dive)
return;
- QDateTime dateTime = QDateTime::fromMSecsSinceEpoch(1000*current_dive->when, Qt::UTC);
- dateTime.setTimeSpec(Qt::UTC);
+ QDateTime dateTime = timestampToDateTime(current_dive->when);
dateTime.setDate(ui.dateEdit->date());
shiftTime(dateTime);
}
@@ -627,8 +618,7 @@ void MainTab::on_timeEdit_editingFinished()
{
if (ignoreInput || !current_dive)
return;
- QDateTime dateTime = QDateTime::fromMSecsSinceEpoch(1000*current_dive->when, Qt::UTC);
- dateTime.setTimeSpec(Qt::UTC);
+ QDateTime dateTime = timestampToDateTime(current_dive->when);
dateTime.setTime(ui.timeEdit->time());
shiftTime(dateTime);
}