From a925e677f18151a894e38043ff0bb06cd9eb20c1 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 26 Jun 2014 16:05:48 -0700 Subject: Correctly use our "localtime" We use time stamps without timezone, so we need to correct for the current time zone offset before showing dates and times in time zone aware widgets. Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'qt-ui/maintab.cpp') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index d46f364fb..3df1e8a32 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -391,8 +391,9 @@ void MainTab::updateDiveInfo(int dive) UPDATE_TEMP(d, watertemp); if (d) { updateGpsCoordinates(d); - ui.dateEdit->setDate(QDateTime::fromTime_t(d->when).date()); - ui.timeEdit->setTime(QDateTime::fromTime_t(d->when).time()); + QDateTime localTime = QDateTime::fromTime_t(d->when - gettimezoneoffset()); + ui.dateEdit->setDate(localTime.date()); + ui.timeEdit->setTime(localTime.time()); if (MainWindow::instance() && MainWindow::instance()->dive_list()->selectedTrips().count() == 1) { setTabText(0, tr("Trip Notes")); // only use trip relevant fields -- cgit v1.2.3-70-g09d2