From 572ef55952d989c842a8edb5eae2e3fe257e8043 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 16 Nov 2015 10:59:42 +0100 Subject: [PATCH] added new internal hook to add missing timestamps from GTFPGA cards --- server/include/hooks.h | 3 +++ server/src/hooks.c | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/server/include/hooks.h b/server/include/hooks.h index 13b366f8a..9914ffd65 100644 --- a/server/include/hooks.h +++ b/server/include/hooks.h @@ -106,6 +106,9 @@ int hook_convert(struct path *p, struct hook *h, int when); /** Example hook: overwrite timestamp of message. */ int hook_ts(struct path *p, struct hook *h, int when); +/** Internal hook: add missing timestamps for node types which do not include a valid TS (ex. GTFPGA) */ +int hook_fix_ts(struct path *p, struct hook *h, int when); + /** Example hook: Finite-Impulse-Response (FIR) filter. */ int hook_fir(struct path *p, struct hook *h, int when); diff --git a/server/src/hooks.c b/server/src/hooks.c index 40b21115b..c9dd23177 100644 --- a/server/src/hooks.c +++ b/server/src/hooks.c @@ -53,6 +53,18 @@ int hook_ts(struct path *p, struct hook *h, int when) return 0; } +REGISTER_HOOK("fix_ts", 0, hook_fix_ts, HOOK_INTERNAL | HOOK_MSG) +int hook_fix_ts(struct path *p, struct hook *h, int when) +{ + struct msg *m = p->current; + + if ((m->ts.sec == 0 && m->ts.nsec == 0) || + (m->ts.sec == -1 && m->ts.nsec == -1)) + hook_ts(p, h, when); + + return 0; +} + REGISTER_HOOK("skip_unchanged", 99, hook_skip_unchanged, HOOK_PRIVATE | HOOK_ASYNC) int hook_skip_unchanged(struct path *p, struct hook *h, int when) {