From cf47d2079fbaa1af35c1ae79fe8c0f94af048e09 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Mon, 8 May 2023 15:11:35 +0200 Subject: [PATCH] changed rounding to be correct --- src/fsfw/pus/Service11TelecommandScheduling.tpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fsfw/pus/Service11TelecommandScheduling.tpp b/src/fsfw/pus/Service11TelecommandScheduling.tpp index 1471e77ab..14d275cb0 100644 --- a/src/fsfw/pus/Service11TelecommandScheduling.tpp +++ b/src/fsfw/pus/Service11TelecommandScheduling.tpp @@ -167,7 +167,10 @@ inline ReturnValue_t Service11TelecommandScheduling::doInsertActivi Clock::getClock_timeval(&tNow); timeval timeDifference = scheduledTime - tNow; // round subseconds up - if (timeDifference.tv_sec + 1 <= RELEASE_TIME_MARGIN_SECONDS) { + if (timeDifference.tv_usec != 0) { + timeDifference.tv_sec++; + } + if (timeDifference.tv_sec <= RELEASE_TIME_MARGIN_SECONDS) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "Service11TelecommandScheduling::doInsertActivity: Release time too close to " "current time"