[lonetix/*,tools/bgpgrep/*] Correct handling of extended timestamps during filtering, decode and dump

This commit is contained in:
Lorenzo Cogotti
2021-08-20 22:37:20 +02:00
parent 39dac63d82
commit db129a0d39
5 changed files with 72 additions and 29 deletions

View File

@ -43,13 +43,13 @@ static Uint32 ParseFrac(const char *s, const char *p, char **ep)
if (res != NCVENOERR)
FATALF("%s: Expecting fractional portion of a second after '.'", s);
int ndigs = endp - p;
double frac = pow(10, ndigs);
int ndigs = endp - p;
long double frac = pow(10, ndigs);
if (ep)
*ep = endp;
return (Uint32) trunc((n / frac) * 100000.0);
return (Uint32) truncl(n / frac * 1000000.0L);
}
static Boolean ParseRfc3339(const char *s, Timestampop *dest)