aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devel/portmk/scripts/ranksites-geoip.pl23
-rw-r--r--ports-mgmt/portmk/scripts/ranksites-geoip.pl23
2 files changed, 26 insertions, 20 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";
diff --git a/ports-mgmt/portmk/scripts/ranksites-geoip.pl b/ports-mgmt/portmk/scripts/ranksites-geoip.pl
index 4631ff6038a3..0777c744982f 100644
--- a/ports-mgmt/portmk/scripts/ranksites-geoip.pl
+++ b/ports-mgmt/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";