nuttxs commented on PR #16658:
URL: https://github.com/apache/nuttx/pull/16658#issuecomment-3030198153

   
   > This should fix the problem when `CONFIG_SYSTEM_TIME64`. However please 
note that when not `CONFIG_SYSTEM_TIME64`, clock_t can still be 32-bit:
   > 
   > See:
   > 
   > 
https://github.com/apache/nuttx/blob/1df6aa92f9da4930e651658b17b068c44e3a0da2/include/sys/types.h#L247
   > 
   > ```
   > /* Used for system times in clock ticks. This type is the natural width of
   >  * the system timer.
   >  *
   >  * NOTE: The signed-ness of clock_t is not specified at OpenGroup.org.  An
   >  * unsigned type is used to support the full range of the internal clock.
   >  */
   > 
   > #ifdef CONFIG_SYSTEM_TIME64
   > typedef uint64_t     clock_t;
   > typedef uint64_t     time_t;         /* Holds time in seconds */
   > #else
   > typedef uint32_t     clock_t;
   > typedef uint32_t     time_t;         /* Holds time in seconds */
   > #endif
   > typedef int          clockid_t;      /* Identifies one time base source */
   > typedef FAR void    *timer_t;        /* Represents one POSIX timer */
   > ```
   > 
   > I am not sure what we can do about that.
   
   When `CONFIG_SYSTEM_TIME64` is enabled.
   Even if `clock_t` is 64 bits, passing a 32-bit parameter can cause overflow 
during multiplication:
   - `SEC2TICK(86400)` treats 86400 as a 32-bit `int`.
   - This leads to overflow in the multiplication `86400 * 1000000` when 
converting to microseconds


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