-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shortcut QDateTime comparison when difference is large
We want to avoid caling toMSecsSinceEpoch() since it's expensive for LocalTime (which is presumed to be the common case). We can do so when both sides have the same offset from UTC (and this can cheaply be determined) but that's no help for two local times months apart, one in DST the other not. However, in this case, the difference in millis is big enough that no plausible difference in offset can overcome it, so we can again avoid toMSecsSinceEpoch() and simply compare millis. This should make some previously-expensive comparisons cheap. Add test-cases to the QDateTime ordering test that verify this doesn't lead to mis-comparison at the biggest offset-difference known. Pick-to: 6.8 Fixes: QTBUG-131491 Change-Id: I1afd5d058c8663c908f898d4c50d0837549b87db Reviewed-by: Christian Ehrlicher <[email protected]>
- Loading branch information
1 parent
fbd8067
commit ef540d7
Showing
2 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters