[tz] [PATCH 0/1] Add Asia/Beijing

Guy Harris guy at alum.mit.edu
Mon Aug 13 20:39:30 UTC 2012


On Aug 13, 2012, at 12:49 PM, James M Leddy wrote:

> * The common proposed fix is that we should be using "human
>   presentable" names and have a mapping from these names to the
>   actual timezones. Since that proposal, indeed since the inception
>   of desktop Linux/Unix, no one (as far as I know) has actually done
>   this,

The desktop (well, laptop) Un*x[*] I'm running will, if I open System Preferences, disable "Set time zone automatically using current location", and drag the little blue location dot over towards China, offer a Time Zone of "China Standard Time" and list a number of cities in the drop-down list, including "Beijing - China" - and symlinks /etc/localtime to /usr/share/zoneinfo/Asia/Harbin.

The map it displays has "Geonames.org" on it.

	http://www.geonames.org

says "The GeoNames geographical database covers all countries and contains over eight million placenames that are available for download free of charge."; it's licensed under a Creative Commons Attribution 3.0 License.

According to

	http://www.geonames.org/export/web-services.html

one service they offer is "Timezone":

> Timezone
> 
> Webservice Type : REST 
> Url : api.geonames.org/timezone?
> Parameters : lat,lng, radius (buffer in km for closest timezone in coastal areas), date (date for sunrise/sunset);
> Result : the timezone at the lat/lng with gmt offset (1. January) and dst offset (1. July) 
> Example http://api.geonames.org/timezone?lat=47.01&lng=10.2&username=demo 
> 
> This service is also available in JSON format : http://api.geonames.org/timezoneJSON?lat=47.01&lng=10.2&username=demo 
> 
> 
> Element:
> timezoneId: name of the timezone (according to olson), this information is sufficient to work with the timezone and defines DST rules, consult the documentation of your development environment.
> time: the local current time
> rawOffset: the amount of time in hours to add to UTC to get standard time in this time zone. Because this value is not affected by daylight saving time, it is called raw offset. 
> gmtOffset: offset to GMT at 1. January (deprecated)
> dstOffset: offset to GMT at 1. July (deprecated)

so it appears that it translates a location to, among other things, an Olson database name.  The example URL is for some location in Austria, as the XML that comes back is

> <geonames>
> <timezone tzversion="tzdata2012c">
> <countryCode>AT</countryCode>
> <countryName>Austria</countryName>
> <lat>47.01</lat>
> <lng>10.2</lng>
> <timezoneId>Europe/Vienna</timezoneId>
> <dstOffset>2.0</dstOffset>
> <gmtOffset>1.0</gmtOffset>
> <rawOffset>1.0</rawOffset>
> <time>2012-08-13 22:31</time>
> <sunrise>2012-08-13 06:14</sunrise>
> <sunset>2012-08-13 20:32</sunset>
> </timezone>
> </geonames>

You might want to tell Mark about this:

	http://www.theregister.co.uk/2008/07/23/shuttleworth_apple_challenge/

[*] It's Lion, so it's not Unix, it's just Un*x:

	http://www.opengroup.org/openbrand/register/


More information about the tz mailing list