diff --git a/src/helper/command.c b/src/helper/command.c
index d5be42dfeea02dfc4c4081bf74c594ccc8da8473..e1751d4fedda0381128a99f6a372e401111f9bfa 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -783,7 +783,7 @@ int handle_sleep_command(struct command_context_s *cmd_ctx, char *cmd, char **ar
 	} else
 	{
 		long long then=timeval_ms();
-		while ((timeval_ms()-then)<duration)
+		while ((timeval_ms()-then)<(long long)duration)
 		{
 			target_call_timer_callbacks_now();
 			usleep(1000);