mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
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:
parent
3a72699bfd
commit
7a740d25a8
2 changed files with 6 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue