summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2025-05-17 15:41:00 +0900
committernagachika <nagachika@ruby-lang.org>2025-05-17 15:41:00 +0900
commita3adc05a4e1f5c5d1cd95eee92da9693b23360bf (patch)
tree52b1b3dc7d9bb036dcc98b9eaa8cadb3c9f16b6a
parentb1b6752fbeb2d23dbea639bd4b331c9e8b56f49c (diff)
merge revision(s) 3e47e7a499acd256be549935fcb559d3c82e556c, 46e4c8673747de96838d2c5dec37446d23d99d88:
Fix redefinition of `clock_gettime` and `clock_getres` winpthreads-git 12.0.0.r720 provides `clock_gettime` and `clock_getres` as inline functions. Detect `clock_gettime` and `clock_getres` for winpthreads
-rw-r--r--configure.ac2
-rw-r--r--include/ruby/win32.h7
-rw-r--r--version.h2
-rw-r--r--win32/win32.c4
4 files changed, 12 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 3b5ea5bade..0f9553ee42 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1210,8 +1210,6 @@ main()
ac_cv_func_gmtime_r=yes
rb_cv_large_fd_select=yes
ac_cv_type_struct_timeval=yes
- ac_cv_func_clock_gettime=yes
- ac_cv_func_clock_getres=yes
ac_cv_func_malloc_usable_size=no
ac_cv_type_off_t=yes
ac_cv_sizeof_off_t=8
diff --git a/include/ruby/win32.h b/include/ruby/win32.h
index dfb56f4182..cfa31db130 100644
--- a/include/ruby/win32.h
+++ b/include/ruby/win32.h
@@ -125,8 +125,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/version.h b/version.h
index d6924e761f..d1790e2011 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 8
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 146
+#define RUBY_PATCHLEVEL 147
#include "ruby/version.h"
#include "ruby/internal/abi.h"
diff --git a/win32/win32.c b/win32/win32.c
index c51d53595f..43c22c3ffe 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4889,6 +4889,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)
@@ -4928,7 +4929,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)
@@ -4956,6 +4959,7 @@ clock_getres(clockid_t clock_id, struct timespec *sp)
return -1;
}
}
+#endif
/* License: Ruby's */
static char *