views:

299

answers:

2

I'd like to (at least) get the name of the country for a time zone. This is not provided by any of the potential methods:

  • name,
  • localizedName:locale:,
  • description

I notice that the built in iPhone clock App has access to this information, as it describes London as "London, England".

Thanks.

A: 

I'm sure that it works different with the built-in clock. There is a database of cities of which each has a country and a timezone. And what would you expect from [myGMT city]? Dublin or Casablanca?

Kai
Are you aware of this database being exposed, or do you believe it to be custom code in the clock app?An NSTimeZone instance does not simply represent a GMT offset (as I think you are implying with your last sentence, but I'm not sure), they represent (as stated in the documentation) "geopolitical regions", and as far as I can see, are always rooted on a specific city. It is quite reasonable to show the country this city is in, as the clock app does.Thanks.
Benjohn Barnes
A: 

From the description of the timeZoneWithName:data: method, the filesystem has timezone information located at /usr/share/zoneinfo.

I have no idea what the format of the files is, or if you can even read them from the application sandbox, but that's likely how the Clock application gets the information.

Ben S
Thanks – The info at that path is related to the TZ database, or Zoneinfo database. It's a standard open data file for representing time zone info used by many architectures – lots of info on wikipedia: http://en.wikipedia.org/wiki/Zoneinfo. The zoneinfo file doesn't provide the country a city is in, however, so I don't think the clock would be using this.
Benjohn Barnes