Make TD print 0000-00-00 for invalid dates.
authorKeith Packard <keithp@keithp.com>
Sun, 22 Nov 2009 04:36:20 +0000 (20:36 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 22 Nov 2009 04:37:53 +0000 (20:37 -0800)
This 'shouldn't' happen, but in case it does, I want to know about it.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/ao_gps_print.c

index b8b73cd..1121317 100644 (file)
@@ -53,10 +53,13 @@ ao_gps_print(__xdata struct ao_gps_data *gps_data) __reentrant
 
                ao_gps_split(gps_data->latitude, &lat);
                ao_gps_split(gps_data->longitude, &lon);
-               printf(" 20%02d-%02d-%02d",
-                      gps_data->year,
-                      gps_data->month,
-                      gps_data->day);
+               if (gps_data->flags & AO_GPS_DATE_VALID)
+                       printf(" 20%02d-%02d-%02d",
+                              gps_data->year,
+                              gps_data->month,
+                              gps_data->day);
+               else
+                       printf (" 0000-00-00");
                printf(" %2d:%02d:%02d",
                       gps_data->hour,
                       gps_data->minute,