xiaoxiang781216 commented on code in PR #18331:
URL: https://github.com/apache/nuttx/pull/18331#discussion_r2866893196


##########
arch/sim/src/sim/posix/sim_hosttime.c:
##########
@@ -107,31 +103,37 @@ void host_sleepuntil(uint64_t nsec)
  * Name: host_settimer
  *
  * Description:
- *   Set up a timer to send periodic signals.
+ *   Set up a one-shot timer that expires at the specified
+ *   absolute time.
  *
  * Input Parameters:
- *   nsec - timer expire time
+ *   nsec - Expiration time in nanoseconds.
  *
  * Returned Value:
- *   On success, (0) zero value is returned, otherwise a negative value.
+ *   Returns 0 on success; otherwise a negative value.
  *
  ****************************************************************************/
 
 int host_settimer(uint64_t nsec)
 {
-  struct itimerspec tspec =
-    {
-      0
-    };
+  struct itimerval it;
+  uint64_t now;
+  uint64_t usec;
+
+  now = host_gettime(false);
+
+  usec = (nsec <= now) ? 1 : (nsec - now) / 1000;

Review Comment:
   ```suggestion
     usec = (nsec <= now ? 1 : (nsec - now + 99) / 1000);
   ```
   and remove line 126



##########
arch/sim/Kconfig:
##########
@@ -37,6 +37,8 @@ config ARCH_CHIP
 
 choice
        prompt "Toolchain Selection"
+       default SIM_TOOLCHAIN_GCC if HOST_LINUX

Review Comment:
   remvoe this line



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to