Is "Timestamp Based Geolocation" possible and have an accuracy in detecting location/cities?
I know the answer is possible 开发者_如何学Cbut the accuracy is the main question.Any idea?
Well the world is divided into about 24 timezones (there's a few odd quirks with 1/2 hr timezones as well) and two hemispheres, where daylight savings are reversed (Summer in the southern hemisphere is Winter in the Northern), so identifying daylight savings, you can effectively divide the world into 48 time segments (not all countries use daylight savings, so it's not perfect, but gives you a rough idea). Of course, you'll need a little bit of javascript to read these settings from the user's PC.
The world surface is 510,072,000 km2, so by using timestamp based locations, you can narrow a user down to an area of about 10,626,500km2. As a comparison Canada (the second largest country in the world) has an area of 9,984,670km2. Mainland USA is split across 5 timezones (including Alaska), so any American user would be limited to an accuracy of 5 cities across the entire country... you can't tell the difference between New York and Miami, or between San Francisco and Seattle. Using timezones, ou couldn't tell if I was in London, Lisbon or Dakar.
If that's an accurate enough guess for you, then all well and good. But GeoIP location gives you a far better accuracy, and libraries already exist to use that method... so why not use it?
Well, with user's local time you can only get his local time:). Really, there isn't any way to determine even their country that way. If you detect, say, UTC+1 - there's no way to find out even if it's Europe or Africa. You get much more accurate results analysing client's IP (See Geo IP Location book) and/or $_SERVER['HTTP_ACCEPT_LANGUAGE']
.
精彩评论