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

   current_usec() returns a uint64_t, but it used TICK2USEC(timebase) to 
convert scheduler ticks to microseconds. On 32-bit clock_t builds, TICK2USEC() 
performs the multiplication in 32-bit arithmetic before the result is widened.
   
   With CONFIG_USEC_PER_TICK=10000, this wraps after about 71.6 minutes:
   
     UINT32_MAX / 1000000 ~= 4294 seconds
   
   After the wrap, up_timer_gettick() can report time near zero again. This can 
leave absolute watchdog timeouts, such as those used by usleep() / 
clock_nanosleep(), waiting for a tick value that will not be reached until the 
32-bit scheduler counter wraps.
   
   Cast timebase to uint64_t before multiplying by USEC_PER_TICK so 
current_usec() remains monotonic across the 32-bit microsecond boundary.
   
   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ## Summary
   
   *Update this section with information on why change is necessary,
    what it exactly does and how, if new feature shows up, provide
    references (dependencies, similar problems and solutions), etc.*
   
   ## Impact
   
   *Update this section, where applicable, on how change affects users,
    build process, hardware, documentation, security, compatibility, etc.*
   
   ## Testing
   
   *This section should provide a detailed description of what you did
   to verify your changes work and do not break existing code.*
   
   *Please provide information about your host machine, the board(s) you
   tested your changes on, and how you tested. Logs should be included.*
   
   *For example, when changing something in the core OS functions, you
   may want to run the OSTest application to verify that there are no
   regressions. Changes to ADC code may warrant running the `adc`
   example. Adding a new uORB driver may require that you run
   `uorb_listener` to verify correct operation.*
   
   *Pure documentation changes can just be tested with `make html`
   (see docs) and verification of the correct format in your
   browser.*
   
   **_PRs without testing information will not be accepted. We will
   request test logs._**
   


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