In the POSIX zone parser, handle no-DST zones the same as name-only

If parsing the standard time data brings us to the end of the zone
info, there is no DST information to use later and it makes sense to
record the zone as simply a fixed-offset zone.

At the same time, handle the case of empty name in the standard time
data; use the zone info as name rather than an empty string.

Change-Id: I34d4ea25d93d821a937949730adee89d82105bc9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Edward Welbourne 2021-04-19 13:45:15 +02:00
parent 605ae62944
commit 28b75584c8
1 changed files with 3 additions and 3 deletions

View File

@ -580,14 +580,14 @@ static QList<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArray
}
}
// If only the name part then no transitions
if (parts.count() == 1) {
// If only the name part, or no DST specified, then no transitions
if (parts.count() == 1 || !dstZone.hasValidOffset()) {
QTimeZonePrivate::Data data;
data.atMSecsSinceEpoch = lastTranMSecs;
data.offsetFromUtc = stdZone.offset;
data.standardTimeOffset = stdZone.offset;
data.daylightTimeOffset = 0;
data.abbreviation = stdZone.name;
data.abbreviation = stdZone.name.isEmpty() ? QString::fromUtf8(parts.at(0)) : stdZone.name;
result << data;
return result;
}