Check for localtime_r and gmtime_r at build instead of testing _REENTRANT. Use localtime_s and gmtime_s on Windows, if available.