Details
-
User Story
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.12.2
-
None
-
0fb30652b54aa0d36b9720becd9f3c3deb7a7806 (qt/qtbase/dev)
Description
Many embedded system use uClibc, it use /etc/TZ and optionaly can fallback to /etc/localtime.
Unfortunately at this moment QTimeZone class does not have it support, I prepare simple prototype, I hope this wil be usefull.
src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -1050,6 +1050,20 @@ QByteArray QTzTimeZonePrivate::systemTimeZoneId() const if (ianaId == "/etc/localtime") ianaId.clear(); +#ifdef __UCLIBC__ + // uclibc use /etc/TZ and support only POSIX timezone + // it support fallback to /etc/localtime, but this is optional + // http://leaf.sourceforge.net/doc/buci-tz3.html + if (ianaId.isEmpty()) { + QFile tzif(QStringLiteral("/etc/TZ")); + if (tzif.open(QIODevice::ReadOnly)) { + QTextStream ts(&tzif); + if (!ts.atEnd()) + ianaId = ts.readLine().toUtf8(); + } + } +#endif + // On most distros /etc/localtime is a symlink to a real file so extract name from the path