QDateTimeParser: drop an invalid and largely pointless "optimization"

Now that the maximum and minimum might not be in local time, the day
might not be the same as the local time day. In any case, the "saving"
of checking for being past the end of that day is negligible compared
to all the other wanton costs of the date-time parser.

This is a follow-up to commit b6a11a4ee5319366f14c11c7cf3a4f1dbf33cfd5;
thanks to Tor Arne for reporting the resulting assertion failures.

Pick-to: 6.7 6.5
Change-Id: I1ba443df9340fa63b8765c25004b51467ca5244d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 070ab9e85208c467d2f59f7fdfc7afe627dc37e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Edward Welbourne 2024-09-20 10:55:20 +02:00 committed by Qt Cherry-pick Bot
parent 8688948a20
commit c7c64e7d0a

View File

@ -1612,16 +1612,11 @@ QDateTimeParser::parse(const QString &input, int position,
}
}
} else {
if (context == FromString) {
// optimization
Q_ASSERT(maximum.date().toJulianDay() == 5373484);
if (scan.value.date().toJulianDay() > 5373484)
scan.state = Invalid;
} else if (scan.value > maximum) {
if (scan.value > maximum)
scan.state = Invalid;
}
QDTPDEBUG << "not checking intermediate because scanned value is" << scan.value << minimum << maximum;
QDTPDEBUG << "not checking intermediate because scanned value is"
<< scan.value << minimum << maximum;
}
}