Simplify: return date and time directly

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2016-01-11 16:40:10 -02:00 committed by Dirk Hohndel
parent 3a72699bfd
commit 7a740d25a8
2 changed files with 6 additions and 9 deletions

View file

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

View file

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