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
  • Yes, that is the traditional definition, even for 64-bit architectures. However, you shouldn't rely on it, since it isn't required. The whole point of having a named data type time_t is to allow implementations to change the actual data type used.

    If you want to print it, you should probably think about

    printf("Time: %lu\n",(long)t);

Reply
  • Yes, that is the traditional definition, even for 64-bit architectures. However, you shouldn't rely on it, since it isn't required. The whole point of having a named data type time_t is to allow implementations to change the actual data type used.

    If you want to print it, you should probably think about

    printf("Time: %lu\n",(long)t);

Children
More questions in this forum