aboutsummaryrefslogtreecommitdiff
path: root/ports-mgmt/portmk/scripts
diff options
context:
space:
mode:
authorOliver Eikemeier <eik@FreeBSD.org>2004-07-07 14:48:44 +0000
committerOliver Eikemeier <eik@FreeBSD.org>2004-07-07 14:48:44 +0000
commite41c0a0867a1fc0e09a21412896d81b94efab86f (patch)
tree4956e91fab7487f5bb0d9be203cfcdb6b2079923 /ports-mgmt/portmk/scripts
parent6687a7a5c2c23804135578a434ae1394832722c9 (diff)
downloadports-e41c0a0867a1fc0e09a21412896d81b94efab86f.tar.gz
ports-e41c0a0867a1fc0e09a21412896d81b94efab86f.zip
Notes
Diffstat (limited to 'ports-mgmt/portmk/scripts')
-rw-r--r--ports-mgmt/portmk/scripts/ranksites-geoip.pl23
1 files changed, 13 insertions, 10 deletions
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";