diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-01-23 17:36:24 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-01-23 17:36:24 -0500 |
commit | 774e5155394231588224bba44aa8a1a5218e9924 (patch) | |
tree | 4e3043196a837eb8480a3a03e16a3ee3e266bbcf /driver_sirf.c | |
parent | bbd3aae79db40fd27a807e0b641966bb51cdc03e (diff) | |
download | gpsd-774e5155394231588224bba44aa8a1a5218e9924.tar.gz |
Fully initialized fields in some time structures.
This fixes an hour-offset bug due to the tm_isdst member being uninitialized.
Diffstat (limited to 'driver_sirf.c')
-rw-r--r-- | driver_sirf.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/driver_sirf.c b/driver_sirf.c index 10cd8d78..20e7b513 100644 --- a/driver_sirf.c +++ b/driver_sirf.c @@ -885,6 +885,7 @@ static gps_mask_t sirf_msg_geodetic(struct gps_device_t *session, unpacked_date.tm_hour = (int)getub(buf, 15); unpacked_date.tm_min = (int)getub(buf, 16); unpacked_date.tm_sec = 0; + unpacked_date.tm_isdst = 0; #ifdef S_SPLINT_S unpacked_date.tm_wday = unpacked_date.tm_yday = 0; #endif /* S_SPLINT_S */ @@ -1017,6 +1018,10 @@ static gps_mask_t sirf_msg_ublox(struct gps_device_t *session, unpacked_date.tm_hour = (int)getub(buf, 30); unpacked_date.tm_min = (int)getub(buf, 31); unpacked_date.tm_sec = 0; + unpacked_date.tm_isdst = 0; +#ifdef S_SPLINT_S + unpacked_date.tm_wday = unpacked_date.tm_yday = 0; +#endif /* S_SPLINT_S */ subseconds = ((unsigned short)getbeu16(buf, 32)) * 1e-3; /*@ -compdef */ session->newdata.time = (timestamp_t)mkgmtime(&unpacked_date) + subseconds; @@ -1071,9 +1076,7 @@ static gps_mask_t sirf_msg_ppstime(struct gps_device_t *session, unpacked_date.tm_mday = (int)getub(buf, 4); unpacked_date.tm_mon = (int)getub(buf, 5) - 1; unpacked_date.tm_year = (int)getbeu16(buf, 6) - 1900; -#ifdef S_SPLINT_S unpacked_date.tm_isdst = 0; -#endif /* S_SPLINT_S */ /*@ -compdef */ session->newdata.time = (timestamp_t)mkgmtime(&unpacked_date); /*@ +compdef */ |