Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37040983
en ru br
Репозитории ALT

Группа :: Система/Библиотеки
Пакет: qt5-base

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: alt-timezone.patch
Скачать


--- a/src/corelib/time/qtimezoneprivate_tz.cpp
+++ b/src/corelib/time/qtimezoneprivate_tz.cpp
@@ -1192,6 +1192,12 @@ public:
             return m_name;
         }
 
+        m_name = etcSysconfigClock();
+        if (!m_name.isEmpty()) {
+            m_last = local;
+            return m_name;
+        }
+
         // Some systems (e.g. uClibc) have a default value for $TZ in /etc/TZ:
         m_name = etcContent(QStringLiteral("/etc/TZ"));
         if (!m_name.isEmpty()) {
@@ -1225,6 +1231,28 @@ private:
         return QT_STAT(path, &data) == -1 ? StatIdent() : StatIdent(data);
     }
 
+    static QByteArray etcSysconfigClock()
+    {
+        // On some Red Hat distros /etc/localtime is real file with name held in /etc/sysconfig/clock
+        // in a line like ZONE="Europe/Oslo" or TIMEZONE="Europe/Oslo" or ZONE=Europe/Oslo
+        QByteArray tz_id;
+        QFile tzif(QStringLiteral("/etc/sysconfig/clock"));
+        if (tzif.open(QIODevice::ReadOnly)) {
+            while (tz_id.isEmpty() && !tzif.atEnd()) {
+                const QByteArray line(tzif.readLine().trimmed());
+                if (line.startsWith("ZONE=\""))
+                    tz_id = line.mid(6, line.length() - 7);
+                else if (line.startsWith("TIMEZONE=\""))
+                    tz_id = line.mid(10, line.length() - 11);
+                else if (line.startsWith("ZONE="))
+                    tz_id = line.mid(5);
+                else if (line.startsWith("TIMEZONE="))
+                    tz_id = line.mid(9);
+            }
+        }
+        return tz_id;
+    }
+
     static QByteArray etcLocalTime()
     {
         // On most distros /etc/localtime is a symlink to a real file so extract
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin