Re: Lat/Lon to Local Time



On Mon, 3 Jul 2006 17:15:47 +0100, "Roger Mills"
<watt.tyler@xxxxxxxxxxxxxx> wrote:

In an earlier contribution to this discussion,
Anna <annalahoud@xxxxxxxxx> wrote:

Sam Wormley wrote:
Anna wrote:
I am writing a program that must calculate local time from
latitude/longitude. I realize this is not a trivial undertaking,
given the social and political issues of time zones. However, it
seems to me that there are programs I've seen that surely must know
the algorithm. Table based lookup is highly undesirable but will do
if there are no other solutions available.

Does anyone know how this is done?


In astronomy...

Longitude to local time
GMT ± (Longitude/15) = local time

I actually must go by political local times, not UT. So although I'd
love to write that ONE line of code, it's not what they have asked of
me. I am sure I am going to have to use a table for all the different
political boundaries. I guess I was just hoping that the solution was
small enough I could avoid it.

I can't see any way of avoiding lookup tables - because there are so many
anomalies relative to the simple 1 hour shift per 15 degrees. You almost
need to do it on a country by county basis - because parts of some countries
will be in an unnatural zone to keep them with the rest of the country.
Don't forget also that some areas shift their local time at certain times of
the year in order to achieve so called "daylight saving". This will, in
general, be the opposite way round in the two hemispheres at any given
longitude. Some areas near to the equator don't bother with daylight saving
time because their daylight hours don't vary much throughout the world. Just
one more spanner in the works - some parts of Australia use *half-hour* time
zones!

Not to mention Chatham Island at 12.75 hours and katmandu at
5.75 hours offsert. have fun building an algorithm to include those.

Oh - and don't forget the International Date Line - it doesn't
exactly run straight down the 180 deg longitude line!

.



Relevant Pages

  • Re: Lat/Lon to Local Time
    ... Longitude to local time ... will be in an unnatural zone to keep them with the rest of the country. ... Some areas near to the equator don't bother with daylight saving ...
    (sci.geo.satellite-nav)
  • Re: Chubb 206
    ... We do not have those big DIY ... superstore here in my country. ... on the zone bypass if all the zones are set for tamper does ...
    (alt.security.alarms)
  • Re: This Day in Peanuts History 10 17 06
    ... following bit of electronic flotsam written by Peter Trei ... In Summary, when zones get redrawn, there is a tendency to ... The Annual Madness of Daylight Saving Time ... He sifts through a century of congressional hearings ...
    (rec.arts.comics.strips)
  • Re: Codex
    ... the Crystal Maze was still on. ... in, still with different zones, but had changed it's name ... Maybe they should have someone set up course plots or other information, morse code that across the airwaves and get teams to pick it up. ... It works the same in every country." ...
    (uk.media.tv.misc)
  • Re: determine when to change to or from daylight savings time
    ... timezones are and the daylight times for those zones and when they switch ... If it were by country then at least you would have a chance. ...
    (comp.lang.perl.misc)