yushuailong opened a new pull request, #19107:
URL: https://github.com/apache/nuttx/pull/19107

   
   ## Summary
   
   `up_timer_gettime()` and the Espressif RTC rdalarm handlers built a timespec 
by calling a free-running microsecond timer twice — once for `tv_sec (/ 
USEC_PER_SEC) `and once for `tv_nsec (% USEC_PER_SEC)`. The timer advances 
between the two reads, so a cal boundary returns an inconsistent, possibly 
backwards time.
   
   Fixed in 4 places by reading the timer once into a local variable and 
deriving both fields from that single snapshot:
   - drivers/timers/arch_timer.c        : up_time
   - arch/xtensa/.../espressif/esp_rtc.c : esp_rtc_rdalarm 
(esp_hr_timer_time_us)
   - arch/risc-v/.../espressif/esp_rtc.c : esp_rtus)
   - arch/risc-v/.../esp32c3-legacy/esp32c3_rtc.c : up_rtc_rdalarm 
(rt_timer_time_us)
   ## Impact
   
   Fixes occasional inconsistent timestamps from these clock/alarm reads. No 
API, build, or configuration change. Behavior identical except at second 
boundaries, where the returned time is now consistent.
   
   ## Testing
   
   CI test


-- 
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