See https://reproducible-builds.org/docs/source-date-epoch/ . The environment
variable `SOURCE_DATE_EPOCH` been recognized by many compilers.
In GCC, if SOURCE_DATE_EPOCH is set, it specifies a UNIX timestamp to be used
in replacement of the current date and time in the __DATE__ and __TIME__
macros. Note: GCC as of today does not update __TIMESTAMP__ (the modification
time of the current source file) but
https://wiki.debian.org/ReproducibleBuilds/TimestampsFromCPPMacros expresses the
intention to update it.
This patches parses SOURCE_DATE_EPOCH and changes all the three macros.
In addition, in case gmtime/localtime returns null (e.g. on 64-bit Windows
gmtime returns null when the timestamp is larger than 32536850399
(3001-01-19T21:59:59Z)), use ??? ?? ???? as used by GCC.
The time_t value may be negative and its value range is platform-dependent. It is better to be as transparent as possible. gmtime/localtime should be able to do the check by returning nullptr.
getAsInteger could handle V as time_t directly.