Fix inverted condition on year starting in DST
The first transition in a year with DST is *to* DST precisely if the
year *doesn't* start in DST, not if it does.
Also fix the startsInDst() check it's using there, which neglected the
possibility that the year's DST transition might be faked.
This amends commit d98b43005e
Pick-to: 6.3
Change-Id: I17422fa9972f826b5bf7e325f5e579f41300fd97
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
parent
fe4c93652c
commit
be79443b68
|
|
@ -416,8 +416,9 @@ struct TransitionTimePair
|
|||
bool startsInDst() const
|
||||
{
|
||||
// Year starts in daylightTimeRule iff it has a valid transition out of
|
||||
// DST before it has a transition into it.
|
||||
return std != QTimeZonePrivate::invalidMSecs() && std < dst;
|
||||
// DST with no earlier valid transition into it.
|
||||
return std != QTimeZonePrivate::invalidMSecs()
|
||||
&& (std < dst || dst == QTimeZonePrivate::invalidMSecs());
|
||||
}
|
||||
|
||||
QTimeZonePrivate::Data ruleToData(const QWinTimeZonePrivate::QWinTransitionRule &rule,
|
||||
|
|
@ -726,7 +727,9 @@ QTimeZonePrivate::Data QWinTimeZonePrivate::nextTransition(qint64 afterMSecsSinc
|
|||
// the rule for year because afterMSecsSinceEpoch is after any
|
||||
// transitions in it. Find first transition in this rule.
|
||||
TransitionTimePair pair(rule, rule.startYear, newYearOffset);
|
||||
return pair.ruleToData(rule, this, pair.startsInDst());
|
||||
// First transition is to DST precisely if the year started in
|
||||
// standard time.
|
||||
return pair.ruleToData(rule, this, !pair.startsInDst());
|
||||
}
|
||||
const int endYear = ruleIndex + 1 < m_tranRules.count()
|
||||
? qMin(m_tranRules.at(ruleIndex + 1).startYear, year + 2) : (year + 2);
|
||||
|
|
|
|||
Loading…
Reference in New Issue