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
This commit is contained in:
nagachika 2025-05-17 15:41:00 +09:00
parent b1b6752fbe
commit a3adc05a4e
4 changed files with 12 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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 *