After some quick investigation, I found that gnome-control-center pulls
its data directly from the zone.tab file, just like Paul Eggert warned
against doing in the comment I quoted above.

in tz.h (https://github.com/GNOME/gnome-control-
center/blob/5532301ce76d2719c1105c61f576abe7fae2dc16/panels/datetime/tz.h)

#  define TZ_DATA_FILE "/usr/share/zoneinfo/zone.tab"

in tz.c (https://github.com/GNOME/gnome-control-
center/blob/5532301ce76d2719c1105c61f576abe7fae2dc16/panels/datetime/tz.c)

static gchar *
tz_data_file_get (void)
{
        gchar *file;

        file = g_strdup (TZ_DATA_FILE);

        return file;
}

[...]

TzDB *
tz_load_db (void)
{
        g_autofree gchar *tz_data_file = NULL;
        TzDB *tz_db;
        FILE *tzfile;
        char buf[4096];

        tz_data_file = tz_data_file_get ();
        if (!tz_data_file) {
                g_warning ("Could not get the TimeZone data file name");
                return NULL;
        }
        tzfile = fopen (tz_data_file, "r");
        if (!tzfile) {
                g_warning ("Could not open *%s*\n", tz_data_file);
                return NULL;
        }

        tz_db = g_new0 (TzDB, 1);
        tz_db->locations = g_ptr_array_new ();

        while (fgets (buf, sizeof(buf), tzfile))
        {
                [PARSING CODE].
        }
        
        fclose (tzfile);
        
        /* now sort by country */
        sort_locations_by_country (tz_db->locations);
        
        /* Load up the hashtable of backward links */
        load_backward_tz (tz_db);

        return tz_db;
}

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gnome-control-center in Ubuntu.
https://bugs.launchpad.net/bugs/1887107

Title:
  Missing entry for timezone database when setting timezone via the text
  search

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/1887107/+subscriptions

-- 
desktop-bugs mailing list
desktop-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to