Skip to content
/ qtbase Public

Commit 2c2abd6

Browse files
committed
QTZP::displayName(): avoid duplicating a check
Delegation to localeName(), when available, takes care of OffsetName, so move displayName()'s handling of OffsetName to the #else of the check for localeName(). Change-Id: I2063fab97588869805b172a0692b2cd9aebc77d5 Reviewed-by: Mate Barany <mate.barany@qt.io>
1 parent 12dd908 commit 2c2abd6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/corelib/time/qtimezoneprivate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,12 @@ QString QTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
197197
{
198198
const Data tran = data(timeType);
199199
if (tran.atMSecsSinceEpoch != invalidMSecs()) {
200+
#if QT_CONFIG(timezone_locale) // Takes care of offsetformat:
201+
return localeName(tran.atMSecsSinceEpoch, tran.offsetFromUtc, timeType, nameType, locale);
202+
#else // All this base can help with is offset names:
200203
if (nameType == QTimeZone::OffsetName && isAnglicLocale(locale))
201204
return isoOffsetFormat(tran.offsetFromUtc);
202-
203-
#if QT_CONFIG(timezone_locale)
204-
return localeName(tran.atMSecsSinceEpoch, tran.offsetFromUtc, timeType, nameType, locale);
205-
#endif
205+
#endif // Hopefully derived classes can do better.
206206
}
207207
return QString();
208208
}

0 commit comments

Comments
 (0)