diff options
author | Nobuyoshi Nakada <[email protected]> | 2025-05-11 14:47:02 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2025-05-12 02:50:25 +0900 |
commit | 3e47e7a499acd256be549935fcb559d3c82e556c (patch) | |
tree | e9cafe9927c454938d77de226ec681a1549629ee | |
parent | f2e5f6dbb605960b69ddced5503a18639aa29e8e (diff) |
Fix redefinition of `clock_gettime` and `clock_getres`
winpthreads-git 12.0.0.r720 provides `clock_gettime` and
`clock_getres` as inline functions.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13302
-rw-r--r-- | include/ruby/win32.h | 7 | ||||
-rw-r--r-- | win32/win32.c | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/ruby/win32.h b/include/ruby/win32.h index 27a3467606..80e1418a1a 100644 --- a/include/ruby/win32.h +++ b/include/ruby/win32.h @@ -126,8 +126,15 @@ typedef unsigned int uintptr_t; #define O_SHARE_DELETE 0x20000000 /* for rb_w32_open(), rb_w32_wopen() */ typedef int clockid_t; +#if defined(__MINGW32__) +#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 +#endif #undef utime #undef lseek diff --git a/win32/win32.c b/win32/win32.c index a2daba2fa1..c57ac49991 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -4761,6 +4761,7 @@ gettimeofday(struct timeval *tv, struct timezone *tz) return 0; } +#if !defined(__MINGW32__) || !defined(HAVE_CLOCK_GETTIME) /* License: Ruby's */ int clock_gettime(clockid_t clock_id, struct timespec *sp) @@ -4800,7 +4801,9 @@ clock_gettime(clockid_t clock_id, struct timespec *sp) return -1; } } +#endif +#if !defined(__MINGW32__) || !defined(HAVE_CLOCK_GETRES) /* License: Ruby's */ int clock_getres(clockid_t clock_id, struct timespec *sp) @@ -4828,6 +4831,7 @@ clock_getres(clockid_t clock_id, struct timespec *sp) return -1; } } +#endif /* License: Ruby's */ static char * |