From 28b75584c815e0932ba792ad1668f9bc6bae4772 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 19 Apr 2021 13:45:15 +0200 Subject: 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 --- src/corelib/time/qtimezoneprivate_tz.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib/time') 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 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; } -- cgit v1.2.3