From 213a814da6692a788db90a2079dfcd1b00359cad Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Wed, 7 Dec 2022 15:26:42 +0100 Subject: [PATCH] =?UTF-8?q?cangen:=20don't=20compare=20floating-point=20ga?= =?UTF-8?q?p=20with=20=E2=80=98=3D=3D=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following warning: | cangen.c:524:7: warning: comparing floating-point with ‘==’ or ‘!=’ is unsafe [-Wfloat-equal] | 524 | if (gap && burst_sent_count >= burst_count) /* gap == 0 => performance test :-] */ | | ^~~ Signed-off-by: Marc Kleine-Budde --- cangen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cangen.c b/cangen.c index 2327064..8cb2fd2 100644 --- a/cangen.c +++ b/cangen.c @@ -521,7 +521,8 @@ resend: } burst_sent_count++; - if (gap && burst_sent_count >= burst_count) /* gap == 0 => performance test :-] */ + if ((ts.tv_sec || ts.tv_nsec) && + burst_sent_count >= burst_count) if (nanosleep(&ts, NULL)) return 1;