changeset 84:00db2c012481

Add dateTimeToLocal() and some comments.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 24 Apr 2017 12:36:27 +0300
parents 83044206479e
children 30babce5c4be
files src/main.cpp
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.cpp	Mon Apr 24 12:36:06 2017 +0300
+++ b/src/main.cpp	Mon Apr 24 12:36:27 2017 +0300
@@ -62,11 +62,25 @@
 }
 
 
-const QString dateTimeToStr(const QDateTime &val)
+//
+// Manipulate given QDateTime value to get desired
+// correct timestamp.
+//
+const QDateTime dateTimeToLocal(const QDateTime &val)
 {
     QDateTime tmp = val;
     tmp.setOffsetFromUtc(0);
-    return tmp.toLocalTime().toString(QStringLiteral("yyyy-MM-dd hh:mm"));
+    return tmp.toLocalTime();
+}
+
+
+//
+// Return a string representation of given QDateTime
+// converted to local time.
+//
+const QString dateTimeToStr(const QDateTime &val)
+{
+    return dateTimeToLocal(val).toString(QStringLiteral("yyyy-MM-dd hh:mm"));
 }