2015-10-17 07:23:37 -07:00
|
|
|
From 26c73d6da84f1b4797421b9ddecef18d6ce588f0 Mon Sep 17 00:00:00 2001
|
2015-09-27 07:46:48 -07:00
|
|
|
From: Thomas Tuegel <ttuegel@gmail.com>
|
|
|
|
Date: Mon, 1 Dec 2014 17:23:22 -0600
|
2015-10-17 07:23:37 -07:00
|
|
|
Subject: [PATCH 04/11] tzdir
|
2015-09-27 07:46:48 -07:00
|
|
|
|
|
|
|
---
|
|
|
|
qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp | 21 +++++++++++++++------
|
|
|
|
1 file changed, 15 insertions(+), 6 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp b/qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp
|
|
|
|
index 29f0e17..3878974 100644
|
|
|
|
--- a/qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp
|
|
|
|
+++ b/qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp
|
|
|
|
@@ -62,7 +62,10 @@ typedef QHash<QByteArray, QTzTimeZone> QTzTimeZoneHash;
|
|
|
|
// Parse zone.tab table, assume lists all installed zones, if not will need to read directories
|
|
|
|
static QTzTimeZoneHash loadTzTimeZones()
|
|
|
|
{
|
|
|
|
- QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
|
|
|
|
+ QString path = qgetenv("TZDIR");
|
|
|
|
+ path += "/zone.tab";
|
|
|
|
+ if (!QFile::exists(path))
|
|
|
|
+ path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
|
|
|
|
if (!QFile::exists(path))
|
|
|
|
path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
|
|
|
|
|
|
|
|
@@ -553,12 +556,18 @@ void QTzTimeZonePrivate::init(const QByteArray &ianaId)
|
|
|
|
if (!tzif.open(QIODevice::ReadOnly))
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
- // Open named tz, try modern path first, if fails try legacy path
|
|
|
|
- tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
|
|
|
|
+ // Try TZDIR first
|
|
|
|
+ QString zoneinfoDir = qgetenv("TZDIR");
|
|
|
|
+ zoneinfoDir += "/" + QString::fromLocal8Bit(ianaId);
|
|
|
|
+ tzif.setFileName(zoneinfoDir);
|
|
|
|
if (!tzif.open(QIODevice::ReadOnly)) {
|
|
|
|
- tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
|
|
|
|
- if (!tzif.open(QIODevice::ReadOnly))
|
|
|
|
- return;
|
|
|
|
+ // Open named tz, try modern path first, if fails try legacy path
|
|
|
|
+ tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
|
|
|
|
+ if (!tzif.open(QIODevice::ReadOnly)) {
|
|
|
|
+ tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
|
|
|
|
+ if (!tzif.open(QIODevice::ReadOnly))
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
--
|
2015-10-17 07:23:37 -07:00
|
|
|
2.5.2
|
2015-09-27 07:46:48 -07:00
|
|
|
|