diff --git a/src/counter.c b/src/counter.c index d71a46f..88269a4 100644 --- a/src/counter.c +++ b/src/counter.c @@ -92,8 +92,12 @@ int main (void) { // add averaging and forming the struct here uint32_t duration = ((current_seconds - last_seconds) * 1000) + (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; + + if (duration >= 1000) { + logmsg(LOG_DEBUG, "one second is over"); + last_seconds = current_seconds; + last_milliseconds = current_milliseconds; + }