diff options
| author | Edward Welbourne <edward.welbourne@qt.io> | 2024-11-25 12:28:07 +0100 |
|---|---|---|
| committer | Edward Welbourne <edward.welbourne@qt.io> | 2024-11-28 19:46:56 +0100 |
| commit | ef540d77751e24fe0b345694f43cdafca3434c68 (patch) | |
| tree | 05db15181362ea7b9986359cb952ce3aef43e517 /examples/opengl/cube/mainwidget.cpp | |
| parent | fbd8067a89ba7abf2a6d063a98edda9b19c9c749 (diff) | |
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 <ch.ehrlicher@gmx.de>
Diffstat (limited to 'examples/opengl/cube/mainwidget.cpp')
0 files changed, 0 insertions, 0 deletions
