summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/time/qtimezoneprivate_mac.mm11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/corelib/time/qtimezoneprivate_mac.mm b/src/corelib/time/qtimezoneprivate_mac.mm
index d3c4fbe5da..4509e316f9 100644
--- a/src/corelib/time/qtimezoneprivate_mac.mm
+++ b/src/corelib/time/qtimezoneprivate_mac.mm
@@ -1,5 +1,6 @@
/****************************************************************************
**
+** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2013 John Layt <jlayt@kde.org>
** Contact: https://www.qt.io/licensing/
**
@@ -94,6 +95,16 @@ void QMacTimeZonePrivate::init(const QByteArray &ianaId)
if (m_nstz)
m_id = ianaId;
}
+ if (!m_nstz) {
+ // macOS has been seen returning a systemTimeZone which reports its name
+ // as Asia/Kolkata, which doesn't appear in knownTimeZoneNames (which
+ // calls the zone Asia/Calcutta). So explicitly check for the name
+ // systemTimeZoneId() returns, and use systemTimeZone if we get it:
+ m_nstz = [NSTimeZone.systemTimeZone retain];
+ Q_ASSERT(m_nstz);
+ if (QString::fromNSString(m_nstz.name).toUtf8() == ianaId)
+ m_id = ianaId;
+ }
}
QString QMacTimeZonePrivate::comment() const