Use time64 implementation by Michael G Schwern to extend allowed date/time range

The main benefit of this is to allow date/time values outside of the 32bit time_t
range which is very important on 32bit platforms. But there are also some other
issues that will be fixed with this, for example on macOS, mktime() will not work
for dates < 1902 despite time_t being 64bit.

In the same run this commit will also use a reentrant version of gmtime64_r that
should help in multithreaded scenarios.

Original code taken from: https://github.com/evalEmpire/y2038
6 files changed