From c0ffc138015c12fba7b9406a57de83474490acfd Mon Sep 17 00:00:00 2001 From: SiZiOUS Date: Sat, 23 Dec 2023 19:16:23 +0000 Subject: [PATCH] `mruby-time`: protect against incorrectly defined `_POSIX_TIMERS` This update avoids the following error: operator '&&' has no right operand (related to _POSIX_TIMERS) See: https://stackoverflow.com/questions/48538243/macro-if-statement-returns-error-operator-has-no-right-operand --- mrbgems/mruby-time/src/time.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c index 001d46b7c..518fb3d61 100644 --- a/mrbgems/mruby-time/src/time.c +++ b/mrbgems/mruby-time/src/time.c @@ -83,6 +83,12 @@ double round(double x) { /** end of Time class configuration */ +/* protection against incorrectly defined _POSIX_TIMERS */ +#if (_POSIX_TIMERS + 0) == 0 +#undef _POSIX_TIMERS +#define _POSIX_TIMERS 0 +#endif + #if (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0) && defined(CLOCK_REALTIME) # define USE_CLOCK_GETTIME #endif