Use calloc & reallocarray to detect/prevent overflow, and some readability adjustment
2038 time_t fix