summaryrefslogtreecommitdiffstats
path: root/core/subsurface-qt
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-05-22 18:02:15 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-22 12:31:06 -0700
commitf63485b444bd8469d24c70f64f3097bed239c7a8 (patch)
tree4960697b8efbe14846c1180160e224d1d903d3b2 /core/subsurface-qt
parent2ba2ea934aac45c6d8b3c6db920776fb2b29cc66 (diff)
downloadsubsurface-f63485b444bd8469d24c70f64f3097bed239c7a8.tar.gz
cleanup: move timestampToDateTime() to qthelper.cpp
Move this function from maintab.cpp to qthelper.cpp. Since the functionality was used in numerous places, use the helper function there as well. This removes a number of inconsistencies. For example, sometime setTimeSpec(Qt::UTC) was called, even though the QDateTime object was already created with that time spec. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/subsurface-qt')
-rw-r--r--core/subsurface-qt/diveobjecthelper.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/core/subsurface-qt/diveobjecthelper.cpp b/core/subsurface-qt/diveobjecthelper.cpp
index 7c8651507..45cb73868 100644
--- a/core/subsurface-qt/diveobjecthelper.cpp
+++ b/core/subsurface-qt/diveobjecthelper.cpp
@@ -328,15 +328,13 @@ DiveObjectHelperGrantlee::DiveObjectHelperGrantlee(const struct dive *d) :
QString DiveObjectHelper::date() const
{
- QDateTime localTime = QDateTime::fromMSecsSinceEpoch(1000 * timestamp, Qt::UTC);
- localTime.setTimeSpec(Qt::UTC);
+ QDateTime localTime = timestampToDateTime(timestamp);
return localTime.date().toString(prefs.date_format_short);
}
QString DiveObjectHelper::time() const
{
- QDateTime localTime = QDateTime::fromMSecsSinceEpoch(1000 * timestamp, Qt::UTC);
- localTime.setTimeSpec(Qt::UTC);
+ QDateTime localTime = timestampToDateTime(timestamp);
return localTime.time().toString(prefs.time_format);
}