Re: Lat/Lon to Local Time



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! Oh - and don't forget the International Date Line - it doesn't
exactly run straight down the 180 deg longitude line!
--
Cheers,
Roger
______
Email address maintained for newsgroup use only, and not regularly
monitored.. Messages sent to it may not be read for several weeks.
PLEASE REPLY TO NEWSGROUP!


.



Relevant Pages

  • Re: Lat/Lon to Local Time
    ... given the social and political issues of time zones. ... 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: Error in time zone settings
    ... http://wwp.greenwichmeantime.com and as read by JavaScript in a test ... Both PC's show the correct local time in the Systray area, ... Zone locked to Greenwich and Daylight Saving OFF. ... It reports ...
    (microsoft.public.windowsxp.general)
  • Re: OT: Pedants[1] New Year
    ... >> I'm still a bit confused as to when I said daylight saving was ... have moved on so the original benefits are no longer valid but I can't ... country then click on the link below to give yourself some ideas about ...
    (uk.rec.motorcycles)
  • Re: clock, daylight savings time
    ... Assembler Services Reference IAR-XCT") whether STCKCONV ... returns local time or GMT nor how Daylight Saving and Leap ... If it is given local time, then the result will be local time. ... TOD clock value or a 128-bit ETOD clock value. ...
    (bit.listserv.ibm-main)
  • Re: Daylight Saving patch for New Zealand
    ... In the 12 hour period leading up to the daylight saving change, ... All of these are old Mac OS 9 applications which were ... by the local time zone's offset from UTC. ...
    (comp.sys.mac.system)