ncasaril opened a new pull request #999: os_time: Prevent 0 ticks returned when 
OS_TICKS_PER_SEC < 1000
URL: https://github.com/apache/mynewt-core/pull/999
 
 
   The os_time_ms_to_ticks assumes the multiplication always proceeds the 
division in the following piece of code: 
   
   ```
    ticks = (uint64_t)ms * OS_TICKS_PER_SEC / 1000;
   ```
   
   With an OS_TICKS_PER_SEC < 1000 the division could result in 0 and give the 
wrong number of ticks. This PR adds () to force multiplication before division. 
Thus:
   
   ```
    ticks = ((uint64_t)ms * OS_TICKS_PER_SEC) / 1000;
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to