Ref T308, using an optimized (faster) function for YYYYmmdd string parsing

Ref T309, found that QDateTime::fromString returns a QDateTime object with local timestamp. Using a optimized version returns UTC objects now.

- The bug was found writing a unit test for Ref T308
- Slack: https://swift-project.slack.com/archives/G7GD2UP9C/p1534848725000100
This commit is contained in:
Klaus Basan
2018-08-21 15:19:16 +02:00
parent d3c3fe2566
commit 183280fa75
13 changed files with 167 additions and 61 deletions

View File

@@ -344,8 +344,7 @@ namespace BlackCore
const QStringList updateParts = currentLine.replace(" ", "").split('=');
if (updateParts.length() < 2) break;
const QString dts = updateParts.at(1).trimmed();
updateTimestampFromFile = QDateTime::fromString(dts, "yyyyMMddHHmmss");
updateTimestampFromFile.setOffsetFromUtc(0);
updateTimestampFromFile = fromStringUtc(dts, "yyyyMMddHHmmss");
const bool alreadyRead = (updateTimestampFromFile == this->getUpdateTimestamp());
if (alreadyRead)
{