lat/lng format when printing is incorrect
authorJohn Crispin <blogic@openwrt.org>
Tue, 11 Aug 2015 14:53:34 +0000 (16:53 +0200)
committerJohn Crispin <blogic@openwrt.org>
Tue, 11 Aug 2015 14:53:34 +0000 (16:53 +0200)
Signed-off-by: Maurice-Jörg Nießen <post@mjniessen.com>
nmea.c

diff --git a/nmea.c b/nmea.c
index ec0a350d33a7a1a8fbe950c774b87b41d4b12605..438de9d7042c635d9ab756389b2aee3a0f1c1fb2 100644 (file)
--- a/nmea.c
+++ b/nmea.c
@@ -144,8 +144,8 @@ nmea_rmc_cb(void)
                LOG("position: %d°%d'%.1f\" %d°%d'%.1f\"\n",
                        latd, latm, flats, lngd, lngm, flngs);
 
-               snprintf(latitude, sizeof(latitude), "%d.%d", latd, ms_to_deg(latm, lats));
-               snprintf(longitude, sizeof(longitude), "%d.%d", lngd, ms_to_deg(lngm, lngs));
+               snprintf(latitude, sizeof(latitude), "%d.%04d", latd, ms_to_deg(latm, lats));
+               snprintf(longitude, sizeof(longitude), "%d.%04d", lngd, ms_to_deg(lngm, lngs));
                LOG("position: %s %s\n", latitude, longitude);
                gps_timestamp();
        }