summaryrefslogtreecommitdiff
path: root/accel-cmd/accel_cmd.c
diff options
context:
space:
mode:
authorDenys Fedoryshchenko <denys.f@collabora.com>2026-10-28 20:47:22 +0200
committerDenys Fedoryshchenko <denys.f@collabora.com>2026-10-28 20:47:22 +0200
commitf36902fa3110277d93f809e04a71cc427a2c6dbc (patch)
treeef66ae31fb7741a50fc12ff100e93371881052a4 /accel-cmd/accel_cmd.c
parenta9e7d43596c5d524b2fe9300102ab8fe20c987f5 (diff)
downloadaccel-ppp-f36902fa3110277d93f809e04a71cc427a2c6dbc.tar.gz
accel-ppp-f36902fa3110277d93f809e04a71cc427a2c6dbc.zip
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 <denys.f@collabora.com>
Diffstat (limited to 'accel-cmd/accel_cmd.c')
-rw-r--r--accel-cmd/accel_cmd.c2
1 files changed, 1 insertions, 1 deletions
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;