From 48f77c26dcb4a9e8d09e718f1b16e6b97c04d9b9 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 3 Aug 2013 03:08:04 +0200 Subject: Add gp_babel_since helper --- src/neigh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/neigh.c') diff --git a/src/neigh.c b/src/neigh.c index 0270192..bffbaa4 100644 --- a/src/neigh.c +++ b/src/neigh.c @@ -68,7 +68,7 @@ uint16_t gp_babel_neigh_get_rxcost(gmrf_context_t *ctx, const gp_babel_neigh_t * if (!neigh->hello_log || !neigh->hello_interval || !neigh->iface) return GP_BABEL_INFINITY; - int timediff = (gmrf_now(ctx->gmrf) - neigh->last_hello)/10; + int timediff = gp_babel_since(ctx, neigh->last_hello); int shift = (timediff - neigh->hello_interval/2)/neigh->hello_interval; if (shift >= 16) @@ -83,7 +83,7 @@ uint16_t gp_babel_neigh_get_rxcost(gmrf_context_t *ctx, const gp_babel_neigh_t * } uint16_t gp_babel_neigh_get_txcost(gmrf_context_t *ctx, const gp_babel_neigh_t *neigh) { - if ((gmrf_now(ctx->gmrf) - neigh->last_ihu)/10 > GP_BABEL_IHU_TIMEOUT(neigh->ihu_interval) || !neigh->iface) + if (gp_babel_since(ctx, neigh->last_ihu) > GP_BABEL_IHU_TIMEOUT(neigh->ihu_interval) || !neigh->iface) return GP_BABEL_INFINITY; else return neigh->txcost; -- cgit v1.2.3