summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/maintab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/maintab.cpp')
-rw-r--r--desktop-widgets/maintab.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/desktop-widgets/maintab.cpp b/desktop-widgets/maintab.cpp
index a3cc151ef..f6e5b7dc6 100644
--- a/desktop-widgets/maintab.cpp
+++ b/desktop-widgets/maintab.cpp
@@ -493,7 +493,7 @@ void MainTab::updateDiveInfo(bool clear)
// 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::fromTime_t(displayed_dive.when - gettimezoneoffset(displayed_dive.when));
+ QDateTime localTime = QDateTime::fromMSecsSinceEpoch(1000*displayed_dive.when, Qt::UTC);
localTime.setTimeSpec(Qt::UTC);
ui.dateEdit->setDate(localTime.date());
ui.timeEdit->setTime(localTime.time());
@@ -1284,7 +1284,7 @@ void MainTab::on_dateEdit_dateChanged(const QDate &date)
if (editMode == IGNORE || acceptingEdit == true)
return;
markChangedWidget(ui.dateEdit);
- QDateTime dateTime = QDateTime::fromTime_t(displayed_dive.when - gettimezoneoffset(displayed_dive.when));
+ QDateTime dateTime = QDateTime::fromMSecsSinceEpoch(1000*displayed_dive.when, Qt::UTC);
dateTime.setTimeSpec(Qt::UTC);
dateTime.setDate(date);
DivePlannerPointsModel::instance()->getDiveplan().when = displayed_dive.when = dateTime.toTime_t();
@@ -1296,7 +1296,7 @@ void MainTab::on_timeEdit_timeChanged(const QTime &time)
if (editMode == IGNORE || acceptingEdit == true)
return;
markChangedWidget(ui.timeEdit);
- QDateTime dateTime = QDateTime::fromTime_t(displayed_dive.when - gettimezoneoffset(displayed_dive.when));
+ QDateTime dateTime = QDateTime::fromMSecsSinceEpoch(1000*displayed_dive.when, Qt::UTC);
dateTime.setTimeSpec(Qt::UTC);
dateTime.setTime(time);
DivePlannerPointsModel::instance()->getDiveplan().when = displayed_dive.when = dateTime.toTime_t();