diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-03-08 15:23:29 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-03-08 15:23:29 +0900 |
| commit | f2b352944106e61c5b3026f01ded737183a94292 (patch) | |
| tree | 5485c3b1e6cce7c2f57eb0a067ad82808c214edc /mrbgems | |
| parent | cb3a6dd16863da17ae84295e64441110a38bb347 (diff) | |
| download | mruby-f2b352944106e61c5b3026f01ded737183a94292.tar.gz mruby-f2b352944106e61c5b3026f01ded737183a94292.zip | |
time.c: fix errors on Windows and macOS; ref #5354
`gmtime_r` detection logic was too strict.
Diffstat (limited to 'mrbgems')
| -rw-r--r-- | mrbgems/mruby-time/src/time.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c index 5446d43f2..15ec7f362 100644 --- a/mrbgems/mruby-time/src/time.c +++ b/mrbgems/mruby-time/src/time.c @@ -66,6 +66,10 @@ double round(double x) { #define NO_GMTIME_R #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) */ /* mruby usually use its own implementation of struct tm to string conversion */ @@ -125,7 +129,7 @@ gettimeofday(struct timeval *tv, void *tz) # include <sys/time.h> # 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 localtime_r(t,r) localtime(t) #endif |
