Fix for PHP notice when given an integer degrees in decimalDegreesToDMS(); using math instead of string manipulation to split integer portion from decimal remainder.

This commit is contained in:
Brion Vibber 2010-06-28 14:41:33 -04:00
parent 53f14ddde6
commit b2ad8ec571

View File

@ -463,12 +463,14 @@ class NoticeListItem extends Widget
$this->out->elementEnd('span'); $this->out->elementEnd('span');
} }
/**
* @param number $dec decimal degrees
* @return array split into 'deg', 'min', and 'sec'
*/
function decimalDegreesToDMS($dec) function decimalDegreesToDMS($dec)
{ {
$deg = intval($dec);
$vars = explode(".",$dec); $tempma = abs($dec) - abs($deg);
$deg = $vars[0];
$tempma = "0.".$vars[1];
$tempma = $tempma * 3600; $tempma = $tempma * 3600;
$min = floor($tempma / 60); $min = floor($tempma / 60);