Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OT?] latitude/longitude to time zone



On Thu, 25 Oct 2007 16:43:05 -0700,
James Walker (email@hidden) wrote:


>Is there any API to map a location specified by latitude and longitude
>to a time zone name or CFTimeZoneRef?  The Date & Time preference panel
>apparently knows how to do that, since you can click a point on a map to
>select a time zone.

I don't know about specific APIs, but I imagine you could
get a very rough estimate by looking up the closest coordinates [*]
in /usr/share/zoneinfo/zone.tab, and feed the resulting time
zone name to CFTimeZoneCreateWithName() (or +[NSTimeZone timeZoneWithName:]).

[*] Possibly using the Haversine Formula:

    <http://www.movable-type.co.uk/scripts/gis-faq-5.1.html>

Or perhaps, if you need better precision, you could use a web
service such as:

    <http://www.earthtools.org/webservices.htm#timezone>


                                    -- marco

-- 
It's not the data universe only, it's human conversation.
They want to turn it into a one-way flow that they have entirely
monetized. I look at the collective human mind as a kind of
ecosystem. They want to clear cut it. They want to go into the
rainforest of human thought and mow the thing down.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >[OT?] latitude/longitude to time zone (From: James Walker <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.