[tz] Time Zone City for China

Guy Harris guy at alum.mit.edu
Tue Jul 21 18:58:45 UTC 2015


On Jul 21, 2015, at 10:07 AM, Paul Eggert <eggert at cs.ucla.edu> wrote:

> 寇含军 wrote:
>> Even the latest Ubuntu systems still only have Shanghai in the "Time and Date Settings".
> 
> Yes, and when I click on Ürümqi the Ubuntu Time & Date selector highlights eastern Kazazhstan instead of any part of China (!).  Also, Ubuntu's selector is still derived from old versions of tzdata that had unnecessary separate entries for Chongqing and Harbin and etc.  And I'm sure it has other bugs.

Several time zone selectors I've seen are lazily-written crap that either directly display the tzdb name or tweak it slightly by, for example, splitting it into continent and city and displaying them in a more "user-friendly" form.

Ubuntu's is one of them, although it at least doesn't do something *really* cheap and crappy such as just displaying tzdb ids directly.

If somebody wants to see how to do it *right*, find a friend with a Mac and ask them to show you the "Time Zone" pane of the "Date & Time" item in System Preferences.  It's a system that uses the tzdb (being a UN*X, after all), but that doesn't expose tzdb identifiers to ordinary users.

If you turn off the "Set time zone automatically using current location" - which, in many cases, is the right way to set the time zone, rather than having the user bother to do anything at all (consider somebody who travels a lot for work, and whose travels take them to multiple time zones) - you can drag the blue "you are here" dot around the map, and it'll show, at the bottom of the screen, a time zone name (not a tzdb name, a name such as "Mountain Daylight Time" or "Central European Standard Time" or "China Standard Time", and a "Closest City" entry below it, with a drop-down list of several nearby cities (most if not all of which are *not* the city in the tzdb name).

The map, at least on my machine running Mountain Lion, has "Geonames.org" on it, so presumably geonames.org is responsible for at least some of the data.  Apple ship a set of time zone boundary files:

	http://www.opensource.apple.com/source/TimeZoneData/TimeZoneData-62/boundaries/

in what I guess is GPX format:

	https://en.wikipedia.org/wiki/GPS_Exchange_Format

I don't know whether Apple got them from somebody else (or who that is) or produced them by themselves.

Some other information, such as time zone names probably comes from the Unicode Common Locale Data Repository.  I'm guessing the nearby city list comes from elsewhere.

So it's a lot of work to make something as good as Apple's, but if there's some way for various free-software UN*Xes to do so together, that might help.  For example, if places to get free-software (free-data?) time zone boundaries, and maps from latitude+longitude to tzdb zones, and lists of cities and their locations, could be enumerated somewhere, that would help, as would common code atop which ${YOUR-FAVORITE-DESKTOP-ENVIRONMENT} could implement code.  (No, I don't have time to do much if any of that, sorry.)

That code and data could also be used by users of tzdb *other* than operating systems.

And, maybe, after enough systems start providing UI that doesn't just show tzdb IDs or slightly-tweaked tzdb IDs, I can stop wishing we'd picked random alphanumeric IDs for tzdb zones, so that people wouldn't end up attaching Deep Significance to the character strings used for them. :-)


More information about the tz mailing list