daily pastebin goal
9%
SHARE
TWEET

TinyGPS::parse_degrees()

a guest Sep 28th, 2012 495 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // mes 04/27/12 increased fractional precision to 7 digits, was 5
  2. unsigned long TinyGPS::parse_degrees()
  3. {
  4.   char *p;
  5.   unsigned long left = gpsatol(_term);
  6.   unsigned long tenk_minutes = (left % 100UL) * 1000000UL;
  7.   for (p=_term; gpsisdigit(*p); ++p);
  8.   if (*p == '.')
  9.   {
  10.     unsigned long mult = 100000;
  11.     while (gpsisdigit(*++p))
  12.     {
  13.       tenk_minutes += mult * (*p - '0');
  14.       mult /= 10;
  15.     }
  16.   }
  17.   return (left / 100) * 10000000 + tenk_minutes / 6;
  18. }
RAW Paste Data
Top