summaryrefslogtreecommitdiffstats
path: root/src/babel.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-08-03 03:08:04 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-08-03 03:08:04 +0200
commit48f77c26dcb4a9e8d09e718f1b16e6b97c04d9b9 (patch)
tree97c5c77b15b82e5ba68f0b60abb04151ca78821a /src/babel.h
parent8ca5dead7f2870ae7a3ea40f40bec5cb9acde2d0 (diff)
downloadbabel-48f77c26dcb4a9e8d09e718f1b16e6b97c04d9b9.tar
babel-48f77c26dcb4a9e8d09e718f1b16e6b97c04d9b9.zip
Add gp_babel_since helper
Diffstat (limited to 'src/babel.h')
-rw-r--r--src/babel.h7
1 files changed, 7 insertions, 0 deletions
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;