OSDN Git Service

Fix two bugs nougat-x86 oreo-x86 pie-x86 q-x86 r-x86 s-x86 android-x86-7.1-r5 android-x86-8.1-r6
authorAlexey Cherepanov <alxchr@gmail.com>
Sun, 17 May 2020 23:31:26 +0000 (07:31 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Sun, 17 May 2020 23:31:26 +0000 (07:31 +0800)
1. inversed timezone correction.
2. nmea string for nmea_cb should be 0-terminated.

gps.c

diff --git a/gps.c b/gps.c
index 4c9f252..a02ae14 100644 (file)
--- a/gps.c
+++ b/gps.c
@@ -308,7 +308,7 @@ nmea_reader_update_time( NmeaReader*  r, Token  tok )
     tm.tm_mday  = r->utc_day;
     tm.tm_isdst = -1;
 
-    fix_time = mktime( &tm ) + r->utc_diff;
+    fix_time = mktime( &tm ) - r->utc_diff;    //alxchr
     r->fix.timestamp = (long long)fix_time * 1000;
     return 0;
 }
@@ -493,6 +493,8 @@ nmea_reader_parse( NmeaReader*  r )
         return;
     }
 
+    r->in[r->pos] = 0; // alxchr
+
     gettimeofday(&tv, NULL);
     if (_gps_state->init)
         _gps_state->callbacks->nmea_cb(tv.tv_sec*1000+tv.tv_usec/1000, r->in, r->pos);