It seems remarkably difficult to find out what a valid range of values is for time_t
.
It is on some platforms 32 bit, on most 64 bit, and so can easily enough be set to LONG_MAX
. However trying to then use that value doesn't really work properly. For instance you can't pass it to localtime
and change it into a struct tm
.
A quick test program to binary search the value tells me it is 67768036191676799. That corresponds to the end of year 2147483647, so that makes sense as a value. But is it this specified anywhere, and is there any reasonable, platform independent value for a maximum usable time_t?