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>
This commit is contained in:
Dirk Hohndel 2014-06-26 16:05:48 -07:00
parent 3de498b466
commit a925e677f1

View file

@ -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