Hello!
I'd like to understand how time zone definitions are meant to be handled
in MeeGo when interacting with timed and mkcal. I might have figured out
most of it from the source, but confirmation would be good, and there's
a potential bug lurking somewhere ;-)
My understanding is that timed holds the information about the current
system time zone. Looking at ksystemtimezone.cpp in kcalcore, it seems
that timed uses the full path to the zone file to identify the current
zone. Is that correct?
void KSystemTimeZonesPrivate::readConfig(bool init)
{
...
m_zoneinfoDir = "/usr/share/zoneinfo";
m_zonetab = "/usr/share/zoneinfo/zone.tab";
Maemo::Timed::Interface timed;
QDBusReply<Maemo::Timed::WallClock::Info> reply =
timed.get_wall_clock_info_sync();
if (reply.isValid()) {
Maemo::Timed::WallClock::Info info = reply.value();
QString localzone = info.etcLocaltime();
kDebug() << "localzone" << localzone;
// TODO now we have to parse local timezone from symlink, Ilya
will
// possibly change this to support previous solution, commented
below
QString x = localzone.mid(localzone.lastIndexOf("/"));
QString y = localzone.mid(0,(localzone.lastIndexOf("/")));
x.prepend(y.mid(y.lastIndexOf("/")+1));
m_localZoneName = x;
//QFile f("/etc/timezone");
//if (f.open(QIODevice::ReadOnly)) {
//QTextStream str(&f);
//m_localZoneName = str.readLine();
//f.close();
//}
I'm not entirely sure about this string parsing here. What is the input,
what is the output? Note that some time zones contain multiple slashes,
like America/Kentucky/Louisville. If
localzone==/usr/share/zoneinfo/America/Kentucky/Louisville, then the
code above incorrectly sets m_localZoneName=Kentucky/Louisville.
When using mkcal, what is the right way to get the current time zone
definition and the list of available time zones? I suppose it is
KSystemTimeZone::local() and KSystemTimeZone::zones(), but these come
without any documentation and were a bit hard to find.
What name identifies a zone in mkcal? "Europe/Berlin"? Hmm, yes, seems
so.
How does mkcal determine the list of system time zones and read their
definitions? I found that it parses /usr/share/zoneinfo/zone.tab, and
there is a KSystemTimeZoneSource::parse(), but where is the code which
actually parses a file like /usr/share/zoneinfo/Europe/Berlin?
I wrote some debug code which dumps the system time zones. All of them
are said to have no summer saving time transitions, which cannot be
right:
KTimeZones::ZoneMap zones = KSystemTimeZones::zones();
BOOST_FOREACH (const KTimeZone &zone, zones) {
SE_LOG_INFO(NULL, NULL, "zone: %s (%s), %s",
zone.name().toLocal8Bit().constData(),
zone.countryCode().toLocal8Bit().constData(),
zone.hasTransitions() ? "has transitions" : "no
transitions");
}
[INFO] zone: Africa/Abidjan (CI), no transitions
[INFO] zone: Africa/Accra (GH), no transitions
[INFO] zone: Africa/Addis_Ababa (ET), no transitions
...
[INFO] zone: Europe/Berlin (DE), no transitions
...
[INFO] zone: Pacific/Wallis (WF), no transitions
My expectation was that the time zone handling code in libical, in
particular icaltimezone_get_builtin_timezones(), is used for all of
this, but that doesn't seem to be the case.
--
Best Regards
Patrick Ohly
Senior Software Engineer
Intel GmbH
Open Source Technology Center
Pützstr. 5 Phone: +49-228-2493652
53129 Bonn
Germany
_______________________________________________
MeeGo-dev mailing list
[email protected]
http://lists.meego.com/listinfo/meego-dev