patacongo commented on pull request #4693:
URL: https://github.com/apache/incubator-nuttx/pull/4693#issuecomment-946728343


   > > if we need 32 bit version, it should be unsigned, as int32_t will wrap 
too soon. i guess 64 bit version should be unsigned too because it should be 
consistent within nuttx.
   > 
   > Yes, int32_t will wrap at 
2038(https://en.wikipedia.org/wiki/Year_2038_problem).
   
   Negative time is never used in NuttX.  Negative time could arise in 
applications as a consequence of arithmetic operations, but that would be a 
non-portable behavior of the application because POSIX permits unsigned time_t. 
 For portability, applications should always cast to an appropriate time before 
performing signed operations.
   
   With unsigned time_t, the range is doubled.  Instead of 2038 (1970 + 68) 
then it should overflow at (1970 + 2*68) = 2,206.  Prior to that date, the 
upper 32-bits of a 64-bit time_t will always be zero.  So a 64-bit is totally 
wasteful until then.  The effect is no just limited to time_t parameters, but 
to the size of all structures that include a time_t field.


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