lat/lon to time offset database

Paul Koning paul_koning at Dell.com
Thu Feb 3 18:54:27 UTC 2011


On Feb 3, 2011, at 1:33 PM, Larry Ober wrote:

> I'm a nubie at understanding the ins and outs of timezones so please forgive 
> me for my potentially dumb questions.
> 
> I am looking at building a small embedded system (No OS) that will require 
> determining the local time from the lat/lon of a location. So basically I need 
> lat/lon to time offset from "GMT".
> 
> I don't really need the geo political information like country or city. 
> However it seems like tz is structured continent/country/city/... 

Actually, you do.  

What you're trying to do may be too hard for a "small embedded system" (depending on what "small" means).

The problem you're up against is that timezones are political constructs.  To know the timezone for a spot on the globe, you have to know what political subdivision it's in; that will tell you what the timezone rule (law or regulation) is that applies to it.

For example, if your position is 41 N, 71 W, that puts you in a part of the USA that uses the Americas/New_York rules (US Eastern Time with daylight savings).  On the other hand, if you're at 35 40 N, 109 03 W, you're in US Mountain time with DST, and move to 35 40 N, 111 30 W, now you're still in US Mountain Time but you've lost DST.

So you need a database of zone boundaries -- which is likely to be fairly large.  Then you figure out which polygon in that database contains your current position.  From that, you have the zone rule that applies to this position.

The zone.tab file might seem like a starting point, but it isn't really; it just lists each of the zones with a single point in that zone.  What you need is the analog of zone.tab but with the bounding polygon for each zone rather than a point inside it.  I believe that data exists somewhere, but I don't remember the location.

	paul





More information about the tz mailing list