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
This commit is contained in:
SiZiOUS
2023-12-23 19:16:23 +00:00
parent 63580581f7
commit c0ffc13801
+6
View File
@@ -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