TIMESPEC_SEC_MAX might be bigger than 53 bits.
The same as 41bc766763dba63ae2529f2f9070b8e26399745c. Read that commit for what is happening.
This commit is contained in:
parent
bf53d6c7d1
commit
33e9601938
Notes:
git
2019-12-26 20:45:55 +09:00
12
thread.c
12
thread.c
@ -1192,11 +1192,21 @@ thread_value(VALUE self)
|
|||||||
#define TIMESPEC_SEC_MAX TIMET_MAX
|
#define TIMESPEC_SEC_MAX TIMET_MAX
|
||||||
#define TIMESPEC_SEC_MIN TIMET_MIN
|
#define TIMESPEC_SEC_MIN TIMET_MIN
|
||||||
|
|
||||||
|
COMPILER_WARNING_PUSH
|
||||||
|
#if __has_warning("-Wimplicit-int-float-conversion")
|
||||||
|
COMPILER_WARNING_IGNORED(-Wimplicit-int-float-conversion)
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
/* C4305: 'initializing': truncation from '__int64' to 'const double' */
|
||||||
|
COMPILER_WARNING_IGNORED(4305)
|
||||||
|
#endif
|
||||||
|
static const double TIMESPEC_SEC_MAX_as_doube = TIMESPEC_SEC_MAX;
|
||||||
|
COMPILER_WARNING_POP
|
||||||
|
|
||||||
static rb_hrtime_t *
|
static rb_hrtime_t *
|
||||||
double2hrtime(rb_hrtime_t *hrt, double d)
|
double2hrtime(rb_hrtime_t *hrt, double d)
|
||||||
{
|
{
|
||||||
/* assume timespec.tv_sec has same signedness as time_t */
|
/* assume timespec.tv_sec has same signedness as time_t */
|
||||||
const double TIMESPEC_SEC_MAX_PLUS_ONE = 2.0 * (TIMESPEC_SEC_MAX / 2 + 1.0);
|
const double TIMESPEC_SEC_MAX_PLUS_ONE = 2.0 * (TIMESPEC_SEC_MAX_as_doube / 2.0 + 1.0);
|
||||||
|
|
||||||
if (TIMESPEC_SEC_MAX_PLUS_ONE <= d) {
|
if (TIMESPEC_SEC_MAX_PLUS_ONE <= d) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user