[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [plasmashell] [Bug 355858] digital clock does not display anything
From: David Edmundson via KDE Bugzilla <bugzilla_noreply () kde ! org>
Date: 2015-11-30 15:38:56
Message-ID: bug-355858-17878-wOVk2h2lZR () http ! bugs ! kde ! org/
[Download RAW message or body]
https://bugs.kde.org/show_bug.cgi?id=355858
--- Comment #7 from David Edmundson <kde@davidedmundson.co.uk> ---
Timezones on Linux are apparently a mess. We have 4 different systems.
/etc/localtime is done by resolving the symlink path.
// Check TZ env var first, if not populated try find it
QByteArray ianaId = qgetenv("TZ");
if (!ianaId.isEmpty() && ianaId.at(0) == ':')
ianaId = ianaId.mid(1);
// On Debian Etch and later /etc/localtime is real file with name held in
/etc/timezone
if (ianaId.isEmpty()) {
QFile tzif(QStringLiteral("/etc/timezone"));
if (tzif.open(QIODevice::ReadOnly)) {
// TODO QTextStream inefficient, replace later
QTextStream ts(&tzif);
if (!ts.atEnd())
ianaId = ts.readLine().toUtf8();
}
}
// On other distros /etc/localtime is symlink to real file so can extract
name from the path
if (ianaId.isEmpty()) {
const QString path =
QFile::symLinkTarget(QStringLiteral("/etc/localtime"));
if (!path.isEmpty()) {
// /etc/localtime is a symlink to the current TZ file, so extract
from path
int index = path.indexOf(QLatin1String("/zoneinfo/")) + 10;
ianaId = path.mid(index).toUtf8();
}
}
// 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"
if (ianaId.isEmpty()) {
QFile tzif(QStringLiteral("/etc/sysconfig/clock"));
if (tzif.open(QIODevice::ReadOnly)) {
// TODO QTextStream inefficient, replace later
QTextStream ts(&tzif);
QString line;
while (ianaId.isEmpty() && !ts.atEnd() && ts.status() ==
QTextStream::Ok) {
line = ts.readLine();
if (line.startsWith(QLatin1String("ZONE="))) {
ianaId = line.mid(6, line.size() - 7).toUtf8();
} else if (line.startsWith(QLatin1String("TIMEZONE="))) {
ianaId = line.mid(10, line.size() - 11).toUtf8();
}
}
}
}
could you set the date with timedatectl?
Finally, do you have the env var TZ set? is there a /etc/timezone?
--
You are receiving this mail because:
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic