time.c: fix errors on Windows and macOS; ref #5354

`gmtime_r` detection logic was too strict.
parent cb3a6dd1
...@@ -66,6 +66,10 @@ double round(double x) { ...@@ -66,6 +66,10 @@ double round(double x) {
#define NO_GMTIME_R #define NO_GMTIME_R
#endif #endif
#endif #endif
#ifdef __STRICT_ANSI__
/* Strict ANSI (e.g. -std=c99) do not provide gmtime_r/localtime_r */
#define NO_GMTIME_R
#endif
/* asctime(3) */ /* asctime(3) */
/* mruby usually use its own implementation of struct tm to string conversion */ /* mruby usually use its own implementation of struct tm to string conversion */
...@@ -125,7 +129,7 @@ gettimeofday(struct timeval *tv, void *tz) ...@@ -125,7 +129,7 @@ gettimeofday(struct timeval *tv, void *tz)
# include <sys/time.h> # include <sys/time.h>
# endif # endif
#endif #endif
#if !(defined(_POSIX_C_SOURCE) || defined(_BSD_SOURCE) || defined(_SVID_SOURCE)) #ifdef NO_GMTIME_R
#define gmtime_r(t,r) gmtime(t) #define gmtime_r(t,r) gmtime(t)
#define localtime_r(t,r) localtime(t) #define localtime_r(t,r) localtime(t)
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment