diff options
Diffstat (limited to 'src/include/port/win32_port.h')
-rw-r--r-- | src/include/port/win32_port.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/include/port/win32_port.h b/src/include/port/win32_port.h index 7ffe5891c69..7789e0431aa 100644 --- a/src/include/port/win32_port.h +++ b/src/include/port/win32_port.h @@ -421,6 +421,19 @@ extern int _pglstat64(const char *name, struct stat *buf); #define strtok_r strtok_s /* + * Supplement to <time.h>. + */ +#ifdef _MSC_VER +/* + * MinGW has these functions if _POSIX_C_SOURCE is defined. Third-party + * libraries might do that, so to avoid clashes we get ahead of it and define + * it ourselves and use the system functions provided by MinGW. + */ +#define gmtime_r(clock, result) (gmtime_s(result, clock) ? NULL : (result)) +#define localtime_r(clock, result) (localtime_s(result, clock) ? NULL : (result)) +#endif + +/* * Locale stuff. * * Extended locale functions with gratuitous underscore prefixes. |