aboutsummaryrefslogtreecommitdiff
path: root/devel/portmk/scripts/ranksites-geoip.pl
diff options
context:
space:
mode:
Diffstat (limited to 'devel/portmk/scripts/ranksites-geoip.pl')
-rw-r--r--devel/portmk/scripts/ranksites-geoip.pl23
1 files changed, 13 insertions, 10 deletions
diff --git a/devel/portmk/scripts/ranksites-geoip.pl b/devel/portmk/scripts/ranksites-geoip.pl
index 4631ff6038a3..0777c744982f 100644
--- a/devel/portmk/scripts/ranksites-geoip.pl
+++ b/devel/portmk/scripts/ranksites-geoip.pl
@@ -125,19 +125,22 @@ if (%newdistance && $hostcount > 1) {
foreach (keys %newdistance) {
my $dist;
my $cc = lc $gi->country_code_by_name($_);
- my ($lat_cc, $lon_cc) = getlatlon($cc)
- if defined $cc;
- # Find the deltas
- my $delta_lat = $lat_cc - $lat_home;
- my $delta_lon = $lon_cc - $lon_home;
+ if ($cc) {
+ my ($lat_cc, $lon_cc) = getlatlon($cc)
+ if defined $cc;
- # Find the Great Circle distance
- my $temp = sin($delta_lat/2.0)**2 + cos($lat_home) * cos($lat_cc) * sin($delta_lon/2.0)**2;
- $dist = atan2(sqrt($temp),sqrt(1-$temp));
+ # Find the deltas
+ my $delta_lat = $lat_cc - $lat_home;
+ my $delta_lon = $lon_cc - $lon_home;
- $distance{$_} = [$dist, $expgood]
- if defined $dist;
+ # Find the Great Circle distance
+ my $temp = sin($delta_lat/2.0)**2 + cos($lat_home) * cos($lat_cc) * sin($delta_lon/2.0)**2;
+ $dist = atan2(sqrt($temp),sqrt(1-$temp));
+
+ $distance{$_} = [$dist, $expgood]
+ if defined $dist;
+ }
}
open RANKS, ">$rankfile";