diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2016-01-11 16:40:10 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-11 15:47:07 -0800 |
commit | 7a740d25a8ee798e0aa6a76df8598a9e83d95c54 (patch) | |
tree | 1947f81afae79de867b5d916dc0757b8a7c496d1 /subsurface-core/subsurface-qt/DiveObjectHelper.cpp | |
parent | 3a72699bfdac5d5c20f2a52543283e6f4ed9a24c (diff) | |
download | subsurface-7a740d25a8ee798e0aa6a76df8598a9e83d95c54.tar.gz |
Simplify: return date and time directly
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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 |