summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-06-28 14:41:33 -0400
committerBrion Vibber <brion@pobox.com>2010-06-28 14:41:33 -0400
commitb2ad8ec571bd68a92e433e817531151ebf8aa4d0 (patch)
tree4b62a40f37a8413f520158104f922c00b0d93d5b
parent53f14ddde6d3c48063c2419916f6961580bb66c3 (diff)
Fix for PHP notice when given an integer degrees in decimalDegreesToDMS(); using math instead of string manipulation to split integer portion from decimal remainder.
-rw-r--r--lib/noticelist.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/noticelist.php b/lib/noticelist.php
index 432ea78d5..e23cf3b6d 100644
--- a/lib/noticelist.php
+++ b/lib/noticelist.php
@@ -463,12 +463,14 @@ class NoticeListItem extends Widget
$this->out->elementEnd('span');
}
+ /**
+ * @param number $dec decimal degrees
+ * @return array split into 'deg', 'min', and 'sec'
+ */
function decimalDegreesToDMS($dec)
{
-
- $vars = explode(".",$dec);
- $deg = $vars[0];
- $tempma = "0.".$vars[1];
+ $deg = intval($dec);
+ $tempma = abs($dec) - abs($deg);
$tempma = $tempma * 3600;
$min = floor($tempma / 60);