std::chrono::system_clock.time_since_epoch and time_t(0) are not guaranteed to use the Unix epoch timestamp, but in practice they almost certainly will. Any differing behavior will be assumed to be an error, unless certain platforms prove to consistently deviate, at which point we'll cope with it by adding offsets.
Do a quick runtime check to verify that time_t(0) == std::chrono::system_clock's epoch time == unix epoch.
Co-authored-by: Anthony Towns <aj@erisian.com.au>
This is a backport of core#21110 [1/2]
https://github.com/bitcoin/bitcoin/pull/21110/commits/3c2e16be22ae04bf56663ee5ec1554d0d569741b
Note: see D5448 for usage of #ifdef _WIN32 to determine gmtime_s availability. It this turns out to not work in the future, we can try to backport core#18358