diff options
Diffstat (limited to 'libparse/gpstolfp.c')
-rw-r--r-- | libparse/gpstolfp.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libparse/gpstolfp.c b/libparse/gpstolfp.c index 5354dd3..c162429 100644 --- a/libparse/gpstolfp.c +++ b/libparse/gpstolfp.c @@ -34,10 +34,8 @@ */ #include <config.h> #include "ntp_fp.h" - -#define GPSORIGIN 2524953600UL /* NTP origin - GPS origin in seconds */ -#define SECSPERWEEK (unsigned)(604800) /* seconds per week - GPS tells us about weeks */ -#define GPSWRAP 990 /* assume week count less than this in the previous epoch */ +#include "ntp_calendar.h" +#include "parse.h" void gpstolfp( @@ -49,10 +47,10 @@ gpstolfp( { if (weeks < GPSWRAP) { - weeks += 1024; + weeks += GPSWEEKS; } - lfp->l_ui = weeks * SECSPERWEEK + days * 86400 + seconds + GPSORIGIN; /* convert to NTP time */ + lfp->l_ui = (uint32_t)(weeks * SECSPERWEEK + days * SECSPERDAY + seconds + GPSORIGIN); /* convert to NTP time */ lfp->l_uf = 0; } |