Skip to content

Commit

Permalink
QDateTimeParser: drop an invalid and largely pointless "optimization"
Browse files Browse the repository at this point in the history
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 b6a11a4;
thanks to Tor Arne for reporting the resulting assertion failures.

Pick-to: 6.5
Change-Id: I1ba443df9340fa63b8765c25004b51467ca5244d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 070ab9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit c7c64e7)
  • Loading branch information
ediosyncratic authored and Qt Cherry-pick Bot committed Sep 25, 2024
1 parent ce5df62 commit 6daf427
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/corelib/time/qdatetimeparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 6daf427

Please sign in to comment.