GitHub

@@ -217,7 +217,7 @@ typedef mrb_int mrb_sec;

217217

(sizeof(time_t) <= 4 ? INT32_MAX : INT64_MAX) \

218218

)

219219220-

#ifndef MRB_NO_FLOAT

220+

#if defined(MRB_NO_FLOAT) || defined(MRB_USE_BIGINT)

221221

/* return true if time_t is fit in mrb_int */

222222

static mrb_bool

223223

fixable_time_t_p(time_t v)

@@ -948,11 +948,18 @@ mrb_time_to_i(mrb_state *mrb, mrb_value self)

948948

struct mrb_time *tm;

949949950950

tm = time_get_ptr(mrb, self);

951-

#ifndef MRB_NO_FLOAT

952951

if (!fixable_time_t_p(tm->sec)) {

952+

#if defined(MRB_USE_BIGINT)

953+

if (MRB_TIME_T_UINT) {

954+

return mrb_bint_new_uint64(mrb, (uint64_t)tm->sec);

955+

}

956+

else {

957+

return mrb_bint_new_int64(mrb, (int64_t)tm->sec);

958+

}

959+

#elif !defined(MRB_NO_FLOAT)

953960

return mrb_float_value(mrb, (mrb_float)tm->sec);

954-

}

955961

#endif

962+

}

956963

return mrb_int_value(mrb, (mrb_int)tm->sec);

957964

}

958965

Read the original on github.com ↗