diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-06-23 11:57:32 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-06-23 11:57:32 -0400 |
commit | 11a189656c22805fdab4e8c6747365060b61617d (patch) | |
tree | 1a12cecbff3e1a10483913f79f37ce50d383ee5f /timebase.c | |
parent | a9fc8af665bd726f43edb02d90eb510667e972c7 (diff) | |
download | gpsd-11a189656c22805fdab4e8c6747365060b61617d.tar.gz |
Move all test log dates to yyyy-mm-dd.
Trying to remember that these used a non-ISO8601 date format was driving
me nuts. All regression tests pass.
Diffstat (limited to 'timebase.c')
-rw-r--r-- | timebase.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -122,19 +122,20 @@ void gpsd_time_init(struct gps_context_t *context, time_t starttime) void gpsd_set_century(struct gps_device_t *session) /* - * Interpret "Date: dd mmm yyyy", setting the session context + * Interpret "Date: yyyy-mm-dd", setting the session context * century from the year. We do this so the behavior of the * regression tests won't depend on what century the daemon * started up in. */ { - unsigned char *cp; + unsigned char *cp; + char *end; int year; if (strstr((char *)session->packet.outbuffer, "Date:") != NULL) { - cp = session->packet.outbuffer + strlen((char *)session->packet.outbuffer) - 1; + cp = session->packet.outbuffer + 5; while (isspace(*cp)) --cp; - year = atoi((char *)cp - 4); + year = strtod((char *)cp, &end); session->context->century = year - (year % 100); } } |