From c773f2f915d864f0e5c02129a36b57ad1965ed3e Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Thu, 25 Jan 2024 23:03:23 +0100 Subject: [PATCH] fix: Wrong length check for logoff time from ATIS --- src/blackcore/airspacemonitor.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/blackcore/airspacemonitor.cpp b/src/blackcore/airspacemonitor.cpp index f4f326509..914aa569e 100644 --- a/src/blackcore/airspacemonitor.cpp +++ b/src/blackcore/airspacemonitor.cpp @@ -737,13 +737,18 @@ namespace BlackCore Q_ASSERT(CThreadUtils::isInThisThread(this)); if (!this->isConnectedAndNotShuttingDown()) { return; } - if (zuluTime.length() == 4) + if (zuluTime.length() == 5) // for example 2000z { // Logic to set logoff time + + QStringView zuluTimeView(zuluTime); + // TODO Replace with Qt 6.0 QStringView::slice() + zuluTimeView.chop(1); // Remove z + bool ok; - const int h = zuluTime.leftRef(2).toInt(&ok); + const int h = zuluTimeView.left(2).toInt(&ok); if (!ok) { return; } - const int m = zuluTime.rightRef(2).toInt(&ok); + const int m = zuluTimeView.right(2).toInt(&ok); if (!ok) { return; } QDateTime logoffDateTime = QDateTime::currentDateTimeUtc(); logoffDateTime.setTime(QTime(h, m));