dev: mark paths likely/unlikely
[netsniff-ng.git] / taia.c
blob34d53473e5f3c12ffc09bfa1c06a9bc7cdd47fdc
1 #include <stdbool.h>
3 #include "taia.h"
5 static const struct taia tolerance_taia = {
6 .sec.x = 0,
7 .nano = 700000000ULL, /* 700ms acceptance window */
8 .atto = 0,
9 };
11 bool taia_looks_good(struct taia *arr_taia, struct taia *pkt_taia)
13 bool good = false;
14 struct taia tmp;
16 if (taia_less(arr_taia, pkt_taia)) {
17 taia_sub(&tmp, pkt_taia, arr_taia);
18 if (taia_less(&tmp, &tolerance_taia))
19 good = true;
20 } else {
21 taia_sub(&tmp, arr_taia, pkt_taia);
22 if (taia_less(&tmp, &tolerance_taia))
23 good = true;
26 return good;