Skip to content
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
[kcalcore] Generate proper timezone data for constant time definition…
…s. Contributes to JB#48628
  • Loading branch information
dcaliste committed Apr 6, 2020
1 parent ed7a28b commit 324c8ae
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kcalcore/icaltimezones.cpp
Expand Up @@ -569,7 +569,7 @@ ICalTimeZoneData::ICalTimeZoneData( const KTimeZoneData &rhs,
transits.at( i - 1 ).phase().utcOffset() :
rhs.previousUtcOffset();
const KTimeZone::Phase phase = transits.at( i ).phase();
if ( phase.utcOffset() == preOffset ) {
if ( phase.utcOffset() == preOffset && trcount > 1 ) {
transitionsDone[i] = true;
while ( ++i < trcount ) {
if ( transitionsDone[i] ||
Expand Down Expand Up @@ -1099,6 +1099,11 @@ ICalTimeZone ICalTimeZoneSource::parse( MSTimeZone *tz )
tz->StandardDate, standardPhase, prevOffset, transitions );
ICalTimeZoneSourcePrivate::parseTransitions(
tz->DaylightDate, daylightPhase, prevOffset, transitions );
// If there is no transition, the initial offset to UTC will not be created,
// force a transition to the first phase at the UNIX origin of time.
if ( transitions.isEmpty() && !phases.isEmpty() ) {
transitions += KTimeZone::Transition(QDateTime(QDate(1970, 1, 1)), phases.first());
}

qSort( transitions );
kdata.setTransitions( transitions );
Expand Down

0 comments on commit 324c8ae

Please sign in to comment.