[PATCH] testsuite/smokey/net: Fix long-standing next shot calculation mistake

Jan Kiszka <[email protected]> Mon, 15 Jun 2026 16:29:52 +0200
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
From: Jan Kiszka <[email protected]>

This was off since day #1. Fortunately, the impact was zero even if we
ever hit this case because rcv_packet is converting the timespec back
to nanoseconds, not passing it to any API which expects a valid struct.

Found by the AI while looking for reasons of sporadic lost packages. In
that run, it attribute them to this issue as well, slightly
over-confident that everything it found is contributing to that.

Reported-by: Claude opus-4.7
Signed-off-by: Jan Kiszka <[email protected]>
---
 testsuite/smokey/net_common/client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testsuite/smokey/net_common/client.c b/testsuite/smokey/net_common/client.c
index 914bda4a49..9a17e413bf 100644
--- a/testsuite/smokey/net_common/client.c
+++ b/testsuite/smokey/net_common/client.c
@@ -176,7 +176,7 @@ static int smokey_net_client_loop(struct smokey_net_client *client)
 		unsigned seq = payload.seq;
 
 		next_shot.tv_nsec += 1000000000 / rate;
-		if (next_shot.tv_nsec > 1000000000) {
+		if (next_shot.tv_nsec >= 1000000000) {
 			next_shot.tv_nsec -= 1000000000;
 			next_shot.tv_sec++;
 		}
-- 
2.47.3