From 49b0974022d4cb61e4b48105352c2ec345abc094 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Thu, 4 Mar 2021 15:02:44 +0100 Subject: [PATCH] time --- src/counter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/counter.c b/src/counter.c index 640b2ea..f84d739 100644 --- a/src/counter.c +++ b/src/counter.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "LS7366R.h" #include "ringbuffer.h" @@ -77,12 +78,14 @@ int main (void) { start(); uint8_t ledTick = 0; + struct timespec timestamp; while (1) { uint32_t period = ringbufferGet(); + clock_gettime(CLOCK_REALTIME, ×tamp); // add averaging and forming the struct here - logmsg(LOG_DEBUG, "Period: %lu", period); + logmsg(LOG_DEBUG, "s: %lu, ns: %lu, p: %lu", timestamp.tv_sec, timestamp.tv_nsec, period); ledTick++; if (ledTick == 50) {