diff --git a/src/villas-hook.cpp b/src/villas-hook.cpp index 2408491ac..4ac3455b9 100644 --- a/src/villas-hook.cpp +++ b/src/villas-hook.cpp @@ -222,12 +222,8 @@ check: if (optarg == endptr) throw RuntimeError("Failed to read from stdin"); } - - if (!(smp->flags & SAMPLE_HAS_TS_RECEIVED)){ - timespec now = time_now(); - smp->ts.received = now; - smp->flags |= SAMPLE_HAS_TS_RECEIVED; - } + + timespec now = time_now(); logger->debug("Read {} smps from stdin", recv); @@ -235,6 +231,11 @@ check: if (optarg == endptr) for (int processed = 0; processed < recv; processed++) { struct sample *smp = smps[processed]; + if (!(smp->flags & SAMPLE_HAS_TS_RECEIVED)){ + smp->ts.received = now; + smp->flags |= SAMPLE_HAS_TS_RECEIVED; + } + ret = h->process(smp); switch (ret) { case HOOK_ERROR: