diff options
Diffstat (limited to 'subsurface-core/subsurface-qt/DiveObjectHelper.cpp')
-rw-r--r-- | subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp index a3ecdf194..a03bd311c 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.cpp +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.cpp @@ -41,11 +41,6 @@ DiveObjectHelper::DiveObjectHelper(struct dive *d) : for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) m_weights << getFormattedWeight(d, i); - - QDateTime localTime = QDateTime::fromTime_t(d->when - gettimezoneoffset(d->when)); - localTime.setTimeSpec(Qt::UTC); - m_date = localTime.date().toString(prefs.date_format); - m_time = localTime.time().toString(prefs.time_format); } DiveObjectHelper::~DiveObjectHelper() @@ -64,7 +59,9 @@ int DiveObjectHelper::id() const QString DiveObjectHelper::date() const { - return m_date; + QDateTime localTime = QDateTime::fromTime_t(m_dive->when - gettimezoneoffset(m_dive->when)); + localTime.setTimeSpec(Qt::UTC); + return localTime.date().toString(prefs.date_format); } timestamp_t DiveObjectHelper::timestamp() const @@ -74,7 +71,9 @@ timestamp_t DiveObjectHelper::timestamp() const QString DiveObjectHelper::time() const { - return m_time; + QDateTime localTime = QDateTime::fromTime_t(m_dive->when - gettimezoneoffset(m_dive->when)); + localTime.setTimeSpec(Qt::UTC); + return localTime.time().toString(prefs.time_format); } QString DiveObjectHelper::location() const |