anchao commented on code in PR #15044:
URL: https://github.com/apache/nuttx/pull/15044#discussion_r1877662778


##########
drivers/timers/arch_alarm.c:
##########
@@ -46,6 +46,7 @@ static FAR struct oneshot_lowerhalf_s *g_oneshot_lower;
 
 #ifndef CONFIG_SCHED_TICKLESS
 static clock_t g_current_tick;
+static clock_t g_base_tick;

Review Comment:
   which very easy to reproduce, you could resolve this issue in sim/nsh. 
Please make the following changes to make host time always return to rtc time:
   
   
   ```
   diff --git a/arch/sim/src/sim/posix/sim_hosttime.c 
b/arch/sim/src/sim/posix/sim_hosttime.c
   index 31608d2f92..7ed992b2d3 100644
   --- a/arch/sim/src/sim/posix/sim_hosttime.c
   +++ b/arch/sim/src/sim/posix/sim_hosttime.c
   @@ -48,6 +48,8 @@ uint64_t host_gettime(bool rtc)
      struct timespec tp;
      uint64_t current;
    
   +  rtc = true;
   +
      clock_gettime(rtc ? CLOCK_REALTIME : CLOCK_MONOTONIC, &tp);
      current = 1000000000ull * tp.tv_sec + tp.tv_nsec;
   ```



-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to