Comment 10 for bug 16285

Revision history for this message
era (era) wrote :

In http://git.gnome.org./cgit/gnome-system-tools/tree/src/time/time-tool.c the function oobs_time_config_get_timezone is used to populate the GUI. This appears to use the functions from System Tools Backends to actually obtain the current time zone.

Now, my understanding of the relationships and dependencies is far from perfect, but I was able to read and roughly understand the code in Time::TimeDate.pm -- it basically compares your /etc/localtime to the available time zone files, and (duh) reports the first match.

But why doesn't it simply read my /etc/timezone?

jaunty$ perl -I/usr/share/system-tools-backends-2.0/scripts -MTime::TimeDate -MUtils::File \
> -le 'print Time::TimeDate::get_timezone("/etc/localtime", "/usr/share/zoneinfo")'
Europe/Mariehamn

jaunty$ cat /etc/timezone
Europe/Helsinki

jaunty$ ls -l /etc/localtime /usr/share/zoneinfo/Europe/{Helsinki,Mariehamn}
-rw-r--r-- 1 root root 1883 2009-07-04 22:07 /etc/localtime
-rw-r--r-- 2 root root 1883 2009-06-18 19:15 /usr/share/zoneinfo/Europe/Helsinki
-rw-r--r-- 2 root root 1883 2009-06-18 19:15 /usr/share/zoneinfo/Europe/Mariehamn

jaunty$ md5sum /etc/localtime /usr/share/zoneinfo/Europe/{Helsinki,Mariehamn}
a2a75461ac17557cba12a846a564e467 /etc/localtime
a2a75461ac17557cba12a846a564e467 /usr/share/zoneinfo/Europe/Helsinki
a2a75461ac17557cba12a846a564e467 /usr/share/zoneinfo/Europe/Mariehamn

Thus, the following locations exhibit the problem:

jaunty$ grep -v '^#' /usr/share/zoneinfo/zone.tab | cut -sf3 |
> perl -I/usr/share/system-tools-backends-2.0/scripts -MTime::TimeDate -MUtils::File -lne '
> $a = $_;
> $tz = Time::TimeDate::get_timezone("/usr/share/zoneinfo/$_", "/usr/share/zoneinfo");
> print "$a != $tz" unless ($a eq $tz)'
Antarctica/South_Pole != Antarctica/McMurdo
Europe/Helsinki != Europe/Mariehamn
Europe/Guernsey != Europe/London
America/Guadeloupe != America/St_Barthelemy
Europe/Zagreb != Europe/Sarajevo
Europe/Isle_of_Man != Europe/London
Europe/Jersey != Europe/London
Europe/Podgorica != Europe/Sarajevo
America/Marigot != America/St_Barthelemy
Europe/Skopje != Europe/Sarajevo
Europe/Belgrade != Europe/Sarajevo
Europe/Ljubljana != Europe/Sarajevo
Arctic/Longyearbyen != Europe/Oslo
Europe/Bratislava != Europe/Prague
Europe/San_Marino != Europe/Rome
America/Shiprock != America/Denver
Europe/Vatican != Europe/Rome

As predicted by this list, I was able to reproduce for Longyearbyen and Jersey as well, and would expect the rest of the list to reprodce this problem as well. For Longyearbyen -> Olso and Jersey -> London the mapping is luckily to the proper main city in the governing territory, so I guess it's less sensitive for them, but it's still a bug. If Rome mapped to San Marino, or Denver to Shiprock, that would be similar to the situation wrt Helsinki/Mariehamn. And Bratislava -> Prague is pretty grave, of course.