From 17968300595cc168c6796e543c174f3da6072639 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Thu, 4 Mar 2021 15:30:09 +0100 Subject: [PATCH] millis --- src/counter.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/counter.c b/src/counter.c index aea59e0..16a93f9 100644 --- a/src/counter.c +++ b/src/counter.c @@ -90,7 +90,12 @@ int main (void) { uint32_t current_milliseconds = timestamp.tv_nsec / 1e6; // add averaging and forming the struct here - logmsg(LOG_DEBUG, "s: %lu, ns: %lu, p: %lu", current_seconds, current_milliseconds, period); + uint32_t duration = (current_seconds - last_seconds) + (current_milliseconds - last_milliseconds); + logmsg(LOG_DEBUG, "s: %lu, ns: %lu, d: %lu, p: %lu", current_seconds, current_milliseconds, duration, period); + last_seconds = current_seconds; + last_milliseconds = current_milliseconds; + + ledTick++; if (ledTick == 50) {