summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <[email protected]>2024-09-20 10:55:20 +0200
committerMårten Nordheim <[email protected]>2024-10-01 06:22:41 +0000
commite9778e6026a68ce3d32bbe841e4b569d55963e97 (patch)
treec036207654d10c6d261d6550685e3422d708897a
parentf3fc7b210f79e5eb427b0ff49c45c5d6d390fb34 (diff)
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. Fixes: QTBUG-129347 Change-Id: I1ba443df9340fa63b8765c25004b51467ca5244d Reviewed-by: Tor Arne Vestbø <[email protected]> (cherry picked from commit 070ab9e85208c467d2f59f7fdfc7afe627dc37e1) Reviewed-by: Qt Cherry-pick Bot <[email protected]> (cherry picked from commit c7c64e7d0a5260913e2afe61ef306520a19cf609) Reviewed-by: Allan Sandfeld Jensen <[email protected]>
-rw-r--r--src/corelib/time/qdatetimeparser.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp
index 0d0da82ae0a..1802a02eac4 100644
--- a/src/corelib/time/qdatetimeparser.cpp
+++ b/src/corelib/time/qdatetimeparser.cpp
@@ -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;
}
}