summaryrefslogtreecommitdiff
path: root/taia.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-06-04 14:52:36 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-06-04 14:52:36 +0200
commit923d6438f34babecfb53c3925d83afa5178641bd (patch)
tree103edb6cae25d3a398fb0ac7af392fa4274db4e1 /taia.c
parent59ebf2978741fb4cf0086440e23a1fcb522fdc21 (diff)
taia: move taia evaluation out of curve.
This is not really related to curve functions, so move it out from there. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Diffstat (limited to 'taia.c')
-rw-r--r--taia.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/taia.c b/taia.c
new file mode 100644
index 0000000..4d02dd9
--- /dev/null
+++ b/taia.c
@@ -0,0 +1,27 @@
+#include <stdbool.h>
+
+#include "taia.h"
+
+static const struct taia tolerance_taia = {
+ .sec.x = 0,
+ .nano = 700000000ULL,
+ .atto = 0,
+};
+
+bool taia_looks_good(struct taia *arr_taia, struct taia *pkt_taia)
+{
+ bool good = false;
+ struct taia tmp;
+
+ if (taia_less(arr_taia, pkt_taia)) {
+ taia_sub(&tmp, pkt_taia, arr_taia);
+ if (taia_less(&tmp, &tolerance_taia))
+ good = true;
+ } else {
+ taia_sub(&tmp, arr_taia, pkt_taia);
+ if (taia_less(&tmp, &tolerance_taia))
+ good = true;
+ }
+
+ return good;
+}