summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt CI Bot <qt_ci_bot@qt-project.org>2021-03-23 15:28:39 +0000
committerQt CI Bot <qt_ci_bot@qt-project.org>2021-03-23 15:28:39 +0000
commitcf4e6070987a580d1722c9939be73e181c9b1ee5 (patch)
tree017b06f83f5ef1488e4f94c1b4ca340bb94c7b06 /src
parent0c97ef1abb1a4566312f9dbcbf4ea84a4ceab5f9 (diff)
parent824d963700a91294ba4a543ebb486aedbd650284 (diff)
Merge integration refs/builds/qtci/dev/1616492874
Diffstat (limited to 'src')
-rw-r--r--src/corelib/time/qtimezoneprivate_tz.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp
index dd3dae78e9..1b0892d062 100644
--- a/src/corelib/time/qtimezoneprivate_tz.cpp
+++ b/src/corelib/time/qtimezoneprivate_tz.cpp
@@ -1187,8 +1187,11 @@ public:
*/
const StatIdent local = identify("/etc/localtime");
const StatIdent tz = identify("/etc/TZ");
- if (!m_name.isEmpty() && m_last.isValid() && (m_last == local || m_last == tz))
+ const StatIdent timezone = identify("/etc/timezone");
+ if (!m_name.isEmpty() && m_last.isValid()
+ && (m_last == local || m_last == tz || m_last == timezone)) {
return m_name;
+ }
m_name = etcLocalTime();
if (!m_name.isEmpty()) {
@@ -1196,12 +1199,19 @@ public:
return m_name;
}
- m_name = etcTZ();
- m_last = m_name.isEmpty() ? StatIdent() : tz;
+ // Some systems (e.g. uClibc) have a default value for $TZ in /etc/TZ:
+ m_name = etcContent(QStringLiteral("/etc/TZ"));
+ if (!m_name.isEmpty()) {
+ m_last = tz;
+ return m_name;
+ }
+
+ // Gentoo still (2020, QTBUG-87326) uses this:
+ m_name = etcContent(QStringLiteral("/etc/timezone"));
+ m_last = m_name.isEmpty() ? StatIdent() : timezone;
return m_name;
}
-
private:
QByteArray m_name;
struct StatIdent
@@ -1242,10 +1252,8 @@ private:
return QByteArray();
}
- static QByteArray etcTZ()
+ static QByteArray etcContent(const QString &path)
{
- // Some systems (e.g. uClibc) have a default value for $TZ in /etc/TZ:
- const QString path = QStringLiteral("/etc/TZ");
QFile zone(path);
if (zone.open(QIODevice::ReadOnly))
return zone.readAll().trimmed();