* set correct time zone
* use RVO (MS review refs #561)
This commit is contained in:
Klaus Basan
2016-01-08 00:27:14 +01:00
parent f607b72821
commit 1ddf470a1d
2 changed files with 3 additions and 2 deletions

View File

@@ -46,8 +46,7 @@ namespace BlackMisc
QJsonValue IDatastoreObjectWithIntegerKey::getDbKeyAsJsonValue() const QJsonValue IDatastoreObjectWithIntegerKey::getDbKeyAsJsonValue() const
{ {
if (this->hasValidDbKey()) { return QJsonValue(this->m_dbKey); } if (this->hasValidDbKey()) { return QJsonValue(this->m_dbKey); }
static const QJsonValue null; return QJsonValue();
return null;
} }
void IDatastoreObjectWithIntegerKey::setKeyAndTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix) void IDatastoreObjectWithIntegerKey::setKeyAndTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix)

View File

@@ -13,6 +13,7 @@
#include "blackmisc/stringutils.h" #include "blackmisc/stringutils.h"
#include <QJsonObject> #include <QJsonObject>
#include <QJsonDocument> #include <QJsonDocument>
#include <QTimeZone>
using namespace BlackMisc; using namespace BlackMisc;
using namespace BlackMisc::Simulation; using namespace BlackMisc::Simulation;
@@ -56,6 +57,7 @@ namespace BlackMisc
{ {
QString ts(timestamp.trimmed().remove(' ').remove('-').remove(':')); // normalize QString ts(timestamp.trimmed().remove(' ').remove('-').remove(':')); // normalize
QDateTime dt = QDateTime::fromString(ts, "yyyyMMddHHmmss"); QDateTime dt = QDateTime::fromString(ts, "yyyyMMddHHmmss");
dt.setTimeZone(QTimeZone::utc());
return dt; return dt;
} }
else else