diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/date/date_core.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c index 1c0d1c4920..c68f70e5f8 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -8811,7 +8811,7 @@ time_to_datetime(VALUE self) ret = d_complex_new_internal(cDateTime, nth, 0, 0, sf, - of, DEFAULT_SG, + of, GREGORIAN, ry, m, d, h, min, s, HAVE_CIVIL | HAVE_TIME); @@ -8915,12 +8915,17 @@ date_to_datetime(VALUE self) static VALUE datetime_to_time(VALUE self) { - volatile VALUE dup = dup_obj(self); + get_d1(self); + + if (m_julian_p(dat)) { + self = d_lite_gregorian(self); + get_d1a(self); + dat = adat; + } + { VALUE t; - get_d1(dup); - t = rb_funcall(rb_cTime, rb_intern("new"), 7, |