+
+SGTimeZone* SGTimeZoneContainer::getNearest(const SGGeod& ref) const
+{
+ SGVec3d refCart(SGVec3d::fromGeod(ref));
+ SGTimeZone* match = NULL;
+ double minDist2 = HUGE_VAL;
+
+ TZVec::const_iterator it = zones.begin();
+ for (; it != zones.end(); ++it) {
+ double d2 = distSqr((*it)->cartCenterpoint(), refCart);
+ if (d2 < minDist2) {
+ match = *it;
+ minDist2 = d2;
+ }
+ }
+
+ return match;
+}
+