diff options
Diffstat (limited to 'clockwatcher.c')
-rw-r--r-- | clockwatcher.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/clockwatcher.c b/clockwatcher.c index 85d890c8..e1191972 100644 --- a/clockwatcher.c +++ b/clockwatcher.c @@ -43,11 +43,9 @@ static time_t timeout; static int debug; #endif /* CLIENTDEBUG_ENABLE */ -static int conditionally_log_fix(struct gps_data_t *gpsdata UNUSED, - bool fix UNUSED) +static void conditionally_log_fix(struct gps_data_t *gpsdata UNUSED) { /* time logging goes here */ - return 0; } static void quit_handler(int signum) @@ -99,7 +97,16 @@ static int socket_mainloop(void) if (source.device != NULL) flags |= WATCH_DEVICE; (void)gps_stream(&gpsdata, flags, source.device); - gps_sock_mainloop(&gpsdata, 5000000, conditionally_log_fix); + + for (;;) { + if (!gps_waiting(&gpsdata, 5000000)) { + (void)fprintf(stderr, "%s: error while waiting\n", progname); + break; + } else { + (void)gps_read(&gpsdata); + conditionally_log_fix(&gpsdata); + } + } (void)gps_close(&gpsdata); return 0; } @@ -124,7 +131,14 @@ static int shm_mainloop(void) return 1; } - gps_shm_mainloop(&gpsdata, 0, conditionally_log_fix); + for (;;) { + status = gps_read(&gpsdata); + + if (status == -1) + break; + if (status > 0) + conditionally_log_fix(&gpsdata); + } (void)gps_close(&gpsdata); return 0; } |