mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
2ba2ea934a
commit
f63485b444
7 changed files with 22 additions and 28 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue