From ed01f3c71eb32a73f062fbd8b6db01ba41d952f4 Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 22 Apr 2016 10:21:16 +0000 Subject: Revert r54694 because of compatibility problem. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@54702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 ----- ext/date/date_core.c | 11 ++++------- test/date/test_date_conv.rb | 8 +++++--- version.h | 2 +- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 82140f0409..2db6e86565 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,11 +33,6 @@ Fri Apr 22 18:22:15 2016 NARUSE, Yui * ext/nkf/nkf-utf8/nkf.c: Merge upstream 4f3edf80a0. patched by Anton Sivakov [Bug #12201] [Bug #12202] -Fri Apr 22 18:19:32 2016 Naotoshi Seo - - * ext/date/date_core.c (datetime_to_time): preserve timezone info - [Bug #12189] [Fix GH-1295] - Fri Apr 22 18:16:51 2016 NARUSE, Yui * lib/securerandom.rb (gen_random): to avoid blocking on Windows. diff --git a/ext/date/date_core.c b/ext/date/date_core.c index da7d82a76a..b93d362bbd 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -8581,24 +8581,21 @@ date_to_datetime(VALUE self) static VALUE datetime_to_time(VALUE self) { - volatile VALUE dup = dup_obj(self); + volatile VALUE dup = dup_obj_with_new_offset(self, 0); { VALUE t; get_d1(dup); - t = rb_funcall(rb_cTime, - rb_intern("new"), - 7, + t = f_utc6(rb_cTime, m_real_year(dat), INT2FIX(m_mon(dat)), INT2FIX(m_mday(dat)), INT2FIX(m_hour(dat)), INT2FIX(m_min(dat)), f_add(INT2FIX(m_sec(dat)), - m_sf_in_sec(dat)), - INT2FIX(m_of(dat))); - return t; + m_sf_in_sec(dat))); + return f_getlocal(t); } } diff --git a/test/date/test_date_conv.rb b/test/date/test_date_conv.rb index e7f412f2ca..daf0374294 100644 --- a/test/date/test_date_conv.rb +++ b/test/date/test_date_conv.rb @@ -31,10 +31,12 @@ class TestDateConv < Test::Unit::TestCase end def test_to_time__from_datetime - d = DateTime.new(2004, 9, 19, 1, 2, 3, 8.to_r/24) + 456789.to_r/86400000000 + d = DateTime.new(2004, 9, 19, 1, 2, 3, 9.to_r/24) + 456789.to_r/86400000000 t = d.to_time - assert_equal([2004, 9, 19, 1, 2, 3, 456789, 8*60*60], - [t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.usec, t.utc_offset]) + if t.utc_offset == 9*60*60 + assert_equal([2004, 9, 19, 1, 2, 3, 456789], + [t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.usec]) + end d = DateTime.new(2004, 9, 19, 1, 2, 3, 0) + 456789.to_r/86400000000 t = d.to_time.utc diff --git a/version.h b/version.h index 76523e8668..91a81d6b2f 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.2.5" #define RUBY_RELEASE_DATE "2016-04-22" -#define RUBY_PATCHLEVEL 313 +#define RUBY_PATCHLEVEL 314 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 4 -- cgit v1.2.3