What primitive data type is time_t?

thyrgle picture thyrgle · May 8, 2010 · Viewed 112.4k times · Source

I do not know the data type of time_t. Is it a float double or something else? Because if I want to display it I need the tag that corresponds with it for printf. I can handle the rest from there for displaying time_t but I need to know the data type that corresponds with it.

Answer

dan04 picture dan04 · May 8, 2010

It's platform-specific. But you can cast it to a known type.

printf("%lld\n", (long long) time(NULL));