tags:

views:

81

answers:

2

I've noticed that on some devices the NSTimeZone's name method for a particular timezone can return different values. When testing the Brisbane time zone, my device returns @"Australia/Brisbane" whereas another user's device returns "Etc/GMT-10". Both iPhone's are running 3.1.2.

The Date and Time Programming Guide for Cocoa states that:

timeZoneWithName: The name passed to this method may be in any of the formats understood by the system, for example EST, Etc/GMT-2, America/Argentina/Buenos_Aires, Europe/Monaco, or US/Pacific, as shown in the following code fragment.

I'd just like to know what could determine which value is used? The device? The language?

A: 

I've never scene what you describe. In my experience it returns the name you created it with.

In any case, if you're using the name for UI display, you should call [NSTimeZone localizedName:locale:] to force the name style you want.

TechZen
A: 

I've discovered what the reason for this was.

When manually setting the timezone from Apple's build-in list, the correct and exact timezone name is returned. However, some mobile carriers provide the current time zone offset over the air, and if this is the case, Apple provide an "Automatic" setting which allows the iPhone to change time zone automatically when they move across into another time zone.

The problem is that while the current GMT offset is provided, there's no way to tell what latitude the user is at. Obviously, there may be for example, several cities in Australia with the a time zone of GMT -10. Therefore, no specific time zone name is available, only that the phone is currently GMT -10.

Michael Waterfall