diff options
author | Nobuyoshi Nakada <[email protected]> | 2025-05-22 11:28:26 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2025-05-22 13:08:39 +0900 |
commit | ec41b1e8231ed9fff207f273d65d7c357151b1d6 (patch) | |
tree | f06a35fdfb307a29f0a0cf5330fdc315172efb15 /include/ruby | |
parent | 056497319658cbefe22351c6ec5c9fa6e4df72bd (diff) |
Fix for old mingw without `clock_gettime` and `clock_getres`
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13405
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/win32.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/include/ruby/win32.h b/include/ruby/win32.h index 80e1418a1a..31dc13e932 100644 --- a/include/ruby/win32.h +++ b/include/ruby/win32.h @@ -127,13 +127,26 @@ typedef unsigned int uintptr_t; typedef int clockid_t; #if defined(__MINGW32__) +/* I don't know why but these return some strange values. */ #undef CLOCK_PROCESS_CPUTIME_ID #undef CLOCK_THREAD_CPUTIME_ID #undef CLOCK_REALTIME_COARSE #endif -#if defined(HAVE_CLOCK_GETTIME) && !defined(CLOCK_REALTIME) -#define CLOCK_REALTIME 0 -#define CLOCK_MONOTONIC 1 + +/* defined in win32/win32.c for old versions */ +#if !defined(__MINGW32__) || !defined(HAVE_CLOCK_GETTIME) +# define HAVE_CLOCK_GETTIME 1 +# define NEED_CLOCK_GETTIME 1 +#endif +#if !defined(__MINGW32__) || !defined(HAVE_CLOCK_GETRES) +# define HAVE_CLOCK_GETRES 1 +# define NEED_CLOCK_GETRES 1 +#endif +#ifndef CLOCK_REALTIME +# define CLOCK_REALTIME 0 +#endif +#ifndef CLOCK_MONOTONIC +# define CLOCK_MONOTONIC 1 #endif #undef utime |