QString QWinTimeZonePrivate::displayName(QTimeZone::TimeType timeType, QTimeZone::NameType nameType, const QLocale &locale) const { // TODO Registry holds MUI keys, should be able to look up translations? Q_UNUSED(locale); if (nameType == QTimeZone::OffsetName) { QWinTransitionRule rule = ruleForYear(QDate::currentDate().year()); if (timeType == QTimeZone::DaylightTime) return isoOffsetFormat((rule.standardTimeBias + rule.daylightTimeBias) * -60); else return isoOffsetFormat((rule.standardTimeBias) * -60); } switch (timeType) { case QTimeZone::DaylightTime : return m_daylightName; case QTimeZone::GenericTime : return m_displayName; case QTimeZone::StandardTime : return m_standardName; } return m_standardName; }
QString QIcuTimeZonePrivate::displayName(QTimeZone::TimeType timeType, QTimeZone::NameType nameType, const QLocale &locale) const { // Return standard offset format name as ICU C api doesn't support it yet if (nameType == QTimeZone::OffsetName) { const Data nowData = data(QDateTime::currentDateTimeUtc().toMSecsSinceEpoch()); // We can't use transitions reliably to find out right dst offset // Instead use dst offset api to try get it if needed if (timeType == QTimeZone::DaylightTime) return isoOffsetFormat(nowData.standardTimeOffset + ucalDaylightOffset(m_id)); else return isoOffsetFormat(nowData.standardTimeOffset); } return ucalTimeZoneDisplayName(m_ucal, timeType, nameType, locale.name()); }
QString QTimeZonePrivate::displayName(qint64 atMSecsSinceEpoch, QTimeZone::NameType nameType, const QLocale &locale) const { if (nameType == QTimeZone::OffsetName) return isoOffsetFormat(offsetFromUtc(atMSecsSinceEpoch)); if (isDaylightTime(atMSecsSinceEpoch)) return displayName(QTimeZone::DaylightTime, nameType, locale); else return displayName(QTimeZone::StandardTime, nameType, locale); }