mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 15:45:42 +08:00
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:
@@ -1338,8 +1338,8 @@ namespace BlackCore
|
||||
self->fromFSD(fp->departAirport),
|
||||
self->fromFSD(fp->destAirport),
|
||||
self->fromFSD(fp->alternateAirport),
|
||||
QDateTime::fromString(depTimePlanned, "hhmm"),
|
||||
QDateTime::fromString(depTimeActual, "hhmm"),
|
||||
fromStringUtc(depTimePlanned, "hhmm"),
|
||||
fromStringUtc(depTimeActual, "hhmm"),
|
||||
CTime(fp->enrouteHrs * 60 + fp->enrouteMins, BlackMisc::PhysicalQuantities::CTimeUnit::min()),
|
||||
CTime(fp->fuelHrs * 60 + fp->fuelMins, BlackMisc::PhysicalQuantities::CTimeUnit::min()),
|
||||
cruiseAlt,
|
||||
|
||||
@@ -112,8 +112,7 @@ namespace BlackCore
|
||||
{
|
||||
// normally the timestamp is always updated from backend
|
||||
// if this changes in the future we're prepared
|
||||
updateTimestamp = QDateTime::fromString(ts, timestampFormat);
|
||||
updateTimestamp.setTimeSpec(Qt::UTC);
|
||||
updateTimestamp = fromStringUtc(ts, timestampFormat);
|
||||
if (this->getUpdateTimestamp() == updateTimestamp) return; // nothing to do
|
||||
|
||||
// save parsing and all follow up actions if nothing changed
|
||||
@@ -166,14 +165,12 @@ namespace BlackCore
|
||||
}
|
||||
else if (name == "time_end")
|
||||
{
|
||||
QDateTime t = QDateTime::fromString(value, timestampFormat);
|
||||
t.setTimeSpec(Qt::UTC);
|
||||
QDateTime t = fromStringUtc(value, timestampFormat);
|
||||
bookedStation.setBookedUntilUtc(t);
|
||||
}
|
||||
else if (name == "time_start")
|
||||
{
|
||||
QDateTime t = QDateTime::fromString(value, timestampFormat);
|
||||
t.setTimeSpec(Qt::UTC);
|
||||
QDateTime t = fromStringUtc(value, timestampFormat);
|
||||
bookedStation.setBookedFromUtc(t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user