PUD: use nmea_time_now
authorFerry Huberts <f.huberts@mindef.nl>
Wed, 20 Jul 2011 11:30:45 +0000 (13:30 +0200)
committerFerry Huberts <f.huberts@mindef.nl>
Mon, 25 Jul 2011 06:28:03 +0000 (08:28 +0200)
Signed-off-by: Ferry Huberts <f.huberts@mindef.nl>
lib/pud/src/receiver.c

index e1f744e..ae3930b 100644 (file)
@@ -21,7 +21,6 @@
 #include <string.h>
 #include <nmea/gmath.h>
 #include <nmea/sentence.h>
-#include <sys/timeb.h>
 #include <math.h>
 #include <net/if.h>
 
@@ -179,19 +178,7 @@ static void txToAllOlsrInterfaces(void) {
 
        if (!transmitGpsInformation.updated
                        && positionValid(&transmitGpsInformation.txPosition)) {
-               struct timeb tp;
-               struct tm nowStruct;
-
-               (void) ftime(&tp);
-               gmtime_r(&tp.time, &nowStruct);
-
-               transmitGpsInformation.txPosition.nmeaInfo.utc.year = nowStruct.tm_year;
-               transmitGpsInformation.txPosition.nmeaInfo.utc.mon = nowStruct.tm_mon;
-               transmitGpsInformation.txPosition.nmeaInfo.utc.day = nowStruct.tm_mday;
-               transmitGpsInformation.txPosition.nmeaInfo.utc.hour = nowStruct.tm_hour;
-               transmitGpsInformation.txPosition.nmeaInfo.utc.min = nowStruct.tm_min;
-               transmitGpsInformation.txPosition.nmeaInfo.utc.sec = nowStruct.tm_sec;
-               transmitGpsInformation.txPosition.nmeaInfo.utc.hsec = (tp.millitm / 10);
+               nmea_time_now(&transmitGpsInformation.txPosition.nmeaInfo.utc);
        }
        aligned_size = gpsToOlsr(&transmitGpsInformation.txPosition.nmeaInfo,
                        (union olsr_message *) &txBuffer[0], sizeof(txBuffer),