summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-26 16:05:48 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-26 16:05:48 -0700
commita925e677f18151a894e38043ff0bb06cd9eb20c1 (patch)
treee7181e5b2a1761552b442e2843a77b5b837f1910
parent3de498b4668add226dcef153da7a715c30fc8ef5 (diff)
downloadsubsurface-a925e677f18151a894e38043ff0bb06cd9eb20c1.tar.gz
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 <dirk@hohndel.org>
-rw-r--r--qt-ui/maintab.cpp5
1 files changed, 3 insertions, 2 deletions
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