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

   ## Summary
   
   - Fix a duplicate `adjtime()` definition when both 
`CONFIG_CLOCK_TIMEKEEPING` and `CONFIG_CLOCK_ADJTIME` are enabled.
   - Keep the software-based `adjtime()` implementation provided by 
`clock_timekeeping.c` when timekeeping is enabled, while retaining 
`clock_adjtime()` support, including the PTP clock path, from `clock_adjtime.c`.
   - Clamp wall-clock slew adjustments in both positive and negative directions.
   - Subtract each applied adjustment from the remaining adjustment so that 
`adjtime()` converges to zero instead of changing the clock indefinitely.
   
   The timekeeping implementation previously calculated and applied a bounded 
adjustment on every wall-clock update, but never removed that amount from 
`g_clock_adjust`. In addition, adjustments larger than the per-update limit 
were always clamped to a positive value, causing large negative adjustments to 
move the clock in the wrong direction.
   
   When `CONFIG_CLOCK_TIMEKEEPING=y` and `CONFIG_CLOCK_ADJTIME=y`, both 
`clock_timekeeping.c` and `clock_adjtime.c` also defined `adjtime()`, resulting 
in a duplicate symbol. The timekeeping implementation now owns `adjtime()` in 
this configuration, while `clock_adjtime.c` continues to provide 
`nxclock_adjtime()` and `clock_adjtime()`.
   
   ## Impact
   
   Bug fix only; no new features.
   
   ## Testing
   
   Host: macOS 26.6.2 ARM64, Apple Clang 21.0.0.
   
   Target: sim:ostest.
   
   Build: make completes successfully with LD: nuttx.
   
   Runtime: ran ./nuttx; all enabled OSTest subtests completed without 
assertions or unexpected errors.
   
   Static checks: nxstyle, checkpatch, and commit-message checks pass.


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