You are here

function coordinates_dd_to_dms in Smart IP 6.2

Same name and namespace in other branches
  1. 8.4 smart_ip.module \coordinates_dd_to_dms()
  2. 8.2 smart_ip.module \coordinates_dd_to_dms()
  3. 8.3 smart_ip.module \coordinates_dd_to_dms()
  4. 6 smart_ip.module \coordinates_dd_to_dms()
  5. 7.2 smart_ip.module \coordinates_dd_to_dms()
  6. 7 smart_ip.module \coordinates_dd_to_dms()

Convert decimal degrees to degrees, minutes, seconds.

2 calls to coordinates_dd_to_dms()
theme_smart_ip_latitude_dms in ./smart_ip.module
Display latitude.
theme_smart_ip_longitude_dms in ./smart_ip.module
Display longitude.

File

./smart_ip.module, line 1526
Determines country, geo location (longitude/latitude), region, city and postal code of the user, based on IP address

Code

function coordinates_dd_to_dms($coord) {
  $negative = $coord < 0 ? TRUE : FALSE;
  $coord = abs($coord);
  $degrees = floor($coord);
  $coord -= $degrees;
  $coord *= 60;
  $minutes = floor($coord);
  $coord -= $minutes;
  $coord *= 60;
  $seconds = round($coord, 6);
  return array(
    $degrees,
    $minutes,
    $seconds,
    $negative,
  );
}