Comment 13 for bug 185190

Revision history for this message
Richard J Foster (richard-foster) wrote : Re: City (Pittsburgh) Associated w/ Wrong Timezone

This certainly coincides with what I'm seeing. St Petersburg, Fl -> Houston, Tx = 787 miles. Clearly less than the 835 miles to Washington, DC.

Could something like ensuring the difference in longitude does not exceed a certain value (presumably somewhere in the 7.5 degree mark) help reduce (or even eliminate) this problem?

I.e. the code would read something like this (WARNING - untested... quite possibly not the correct syntax!):

        for (l = zones; l; l = l->next) {
                ClockZoneInfo *info = l->data;
                clock_zoneinfo_get_coords (info, &zlat, &zlon);

                d = distance (lat, lon, zlat*M_PI/180.0, zlon*M_PI/180.0);

                if (d < dist && abs(lon - zlon*M_PI/180.0) <= 7.5) {
                        best = info;
                        dist = d;
                }
        }