This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RVCT :time_t

time_t is defined in time.h as :

typedef unsigned int time_t;

In my opinion it should be defined as :

typedef long time_t;

Am I right ?

Parents Reply Children
  • Slip of the finger. The typecast is correct, but it should be "%ld", and not "%lu". The time_t datatype is signed just because it should be possible to store a negative difference in it.

    This is the big reason why the data type isn't just changed from long to unsigned long - a lot of programs would break then. In early 2038, we will see if your microcontrollers have suddenly become 64-bit or if a lot of hardware appliances will suddenly break :)

    C99 isn't always available :(