diff options
Diffstat (limited to 'subsurface-core')
-rw-r--r-- | subsurface-core/subsurface-qt/DiveObjectHelper.cpp | 13 | ||||
-rw-r--r-- | subsurface-core/subsurface-qt/DiveObjectHelper.h | 2 |
2 files changed, 6 insertions, 9 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 diff --git a/subsurface-core/subsurface-qt/DiveObjectHelper.h b/subsurface-core/subsurface-qt/DiveObjectHelper.h index 160bbfb8e..5702535ba 100644 --- a/subsurface-core/subsurface-qt/DiveObjectHelper.h +++ b/subsurface-core/subsurface-qt/DiveObjectHelper.h @@ -62,8 +62,6 @@ public: QString otu() const; private: - QString m_date; - QString m_time; QStringList m_weights; QStringList m_cylinders; struct dive *m_dive; |