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/babel.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/babel.h') diff --git a/src/babel.h b/src/babel.h index 93a3bcd..0b0b4d4 100644 --- a/src/babel.h +++ b/src/babel.h @@ -152,6 +152,13 @@ static inline bool gp_babel_less(uint16_t a, uint16_t b) { return (diff < 0); } +static inline int64_t gp_babel_since(gmrf_context_t *ctx, gmrf_time_t t) { + if (t == gmrf_time_unspec) + return INT64_MAX; + + return (gmrf_now(ctx->gmrf) - t)/10; +} + static inline bool gp_babel_is_metric_better(gp_babel_metric_seqno_t ms1, gp_babel_metric_seqno_t ms2) { if (ms1.metric == GP_BABEL_INFINITY) return false; -- cgit v1.2.3