From f36902fa3110277d93f809e04a71cc427a2c6dbc Mon Sep 17 00:00:00 2001 From: Denys Fedoryshchenko Date: Wed, 28 Oct 2026 20:47:22 +0200 Subject: accel-cmd: convert millisecond timeouts to nanoseconds correctly The fractional part of a millisecond timeout was multiplied by 1000 instead of 1000000, so 1500ms became 1.0005 seconds. Correct the conversion and add a CTest regression covering subsecond values, second boundaries, microseconds, and invalid input. Initialize CTest before configuring the client subdirectory. Validation: Release build and CTest pass. The regression fails against upstream master at 1ms. Signed-off-by: Denys Fedoryshchenko --- accel-cmd/accel_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'accel-cmd/accel_cmd.c') diff --git a/accel-cmd/accel_cmd.c b/accel-cmd/accel_cmd.c index 3de8624f..6a6dc678 100644 --- a/accel-cmd/accel_cmd.c +++ b/accel-cmd/accel_cmd.c @@ -536,7 +536,7 @@ static int set_timespec(struct timespec *timeout, const char *str) timeout->tv_nsec = 0; } else if (strcmp(end, "ms") == 0) { timeout->tv_sec = ulong / 1000; - timeout->tv_nsec = (ulong % 1000) * 1000; + timeout->tv_nsec = (ulong % 1000) * 1000000; } else if (strcmp(end, "us") == 0) { timeout->tv_sec = ulong / 1000000; timeout->tv_nsec = (ulong % 1000000) * 1000; -- cgit v1.2.3