summaryrefslogtreecommitdiffstats
path: root/src/winmain
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2016-12-06 13:44:00 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2018-01-18 14:27:42 +0000
commitf9b8ea4b0eaea94a6d724a0955b13fd8a97d96e3 (patch)
treee7a1f45e977df41bada7d6f336e0f71c79c2f0cb /src/winmain
parent016ab238b66d84a58b665782d25daaffdf1708bd (diff)
Fix QMacTimeZonePrivate::previousTransition() for early after epoch
The native APIs don't support previous transition, only next after a stipulated date. The prior code started its search at the epoch; if used for a time before the first transition after the epoch, this found no transitions so returned invalid data, when the last transition before the epoch would have been suitable. It also wound through all transitions since the epoch, on its way to the selected time, which was potentially laborious. Instead, start a year before the stipulated time; this should get a transition if the zone uses DST. If it doesn't, start with the first known transition and binary-chop our way to one within a year of the last before the stipulated time; then wind forward one transition at a time, as before. The chopping is actually faster than binary: each time we find a transition after the interval mid-point but early enough, we move the early end of our interval to the transition, which is later than the old interval's middle. Using halving, starting with a vast interval, should thus only incur modest cost, while ensuring we give up early when no transition data is available at all or the zone's first transition ever was after the stipulated time. Task-number: QTBUG-65443 Change-Id: I96c14540fc2600837e6a22e480fb8dc36cb37220 (cherry picked from commit 7c0b706488b0edcc2fd6db7870db700ff0548f21) (cherry picked from commit a090076e93487f8e461d9b866b9da1c0c21cb59b) Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Jason Dolan <jason.t.dolan@gmail.com>
Diffstat (limited to 'src/winmain')
0 files changed, 0 insertions, 0 deletions