Advertisement
Guest User

TinyGPS::parse_degrees()

a guest
Sep 28th, 2012
1,014
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement