diff --git a/src/time.c b/src/time.c index 15e8d1f0..e392d070 100644 --- a/src/time.c +++ b/src/time.c @@ -30,12 +30,15 @@ */ void normalize_gps_time(gps_time_t *t) { + assert(!isnan(t->tow)); + assert(!isinf(t->tow)); + while(t->tow < 0) { t->tow += WEEK_SECS; t->wn -= 1; } - while(t->tow > WEEK_SECS) { + while(t->tow >= WEEK_SECS) { t->tow -= WEEK_SECS; t->wn += 1; }