diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-04-19 13:45:15 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-04-20 21:33:00 +0200 |
commit | 28b75584c815e0932ba792ad1668f9bc6bae4772 (patch) | |
tree | d8bfa1a7741e25ed764502a4a35751a84be9bb50 /src/corelib/time | |
parent | 605ae629441d5c00f2c9de7080f5c25558d69acb (diff) |
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>
Diffstat (limited to 'src/corelib/time')
-rw-r--r-- | src/corelib/time/qtimezoneprivate_tz.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp index 43043a9d4f..2955a5c957 100644 --- a/src/corelib/time/qtimezoneprivate_tz.cpp +++ b/src/corelib/time/qtimezoneprivate_tz.cpp @@ -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; } |