diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-03-28 19:02:23 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-03-28 19:02:23 -0400 |
commit | 009ba6e3452df29cbf1757bc0c79dc14683a98da (patch) | |
tree | 4775cfa65e817c69a6f29a0ac87daab8701c7ae2 /gpsutils.c | |
parent | 5f710d3469c8da31014000ac13664fe92c57757d (diff) | |
download | gpsd-009ba6e3452df29cbf1757bc0c79dc14683a98da.tar.gz |
Clean up most spint errors. All regression tests pass.
Diffstat (limited to 'gpsutils.c')
-rw-r--r-- | gpsutils.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -27,6 +27,15 @@ #include <QStringList> #endif +#ifdef S_SPLINT_S +/*@-matchfields@*/ +struct timespec + { + time_t tv_sec; /* Seconds. */ + long tv_nsec; /* Nanoseconds. */ + }; +/*@+matchfields@*/ +#endif /* S_SPLINT_S */ /* * Berkeley implementation of strtod(), inlined to avoid locale problems * with the decimal point and stripped down to an atof()-equivalent. @@ -300,8 +309,8 @@ void gps_merge_fix( /*@ out @*/ struct gps_fix_t *to, timestamp_t timestamp(void) { struct timespec ts; - (void)clock_gettime(CLOCK_REALTIME, &ts); - return (timestamp_t)(ts.tv_sec + ts.tv_nsec * 1e-9); + /*@i2@*/(void)clock_gettime(CLOCK_REALTIME, &ts); + /*@i2@*/return (timestamp_t)(ts.tv_sec + ts.tv_nsec * 1e-9); } time_t mkgmtime(register struct tm * t) @@ -343,7 +352,7 @@ timestamp_t iso8601_to_unix( /*@in@*/ char *isotime) struct tm tm; memset(&tm,0,sizeof(tm)); - dp = strptime(isotime, "%Y-%m-%dT%H:%M:%S", &tm); + /*@i1@*/ dp = strptime(isotime, "%Y-%m-%dT%H:%M:%S", &tm); if (dp != NULL && *dp == '.') usec = strtod(dp, NULL); else @@ -392,7 +401,7 @@ timestamp_t iso8601_to_unix( /*@in@*/ char *isotime) */ (void)snprintf(fractstr, sizeof(fractstr), "%.3f", fractional); /* add fractional part, ignore leading 0; "0.2" -> ".2" */ - (void)snprintf(isotime, len, "%s%sZ",timestr, strchr(fractstr,'.')); + /*@i2@*/(void)snprintf(isotime, len, "%s%sZ",timestr, strchr(fractstr,'.')); return isotime; } /* *INDENT-ON* */ |