ruby-changes:42620
From: usa <ko1@a...>
Date: Fri, 22 Apr 2016 17:24:02 +0900 (JST)
Subject: [ruby-changes:42620] usa:r54694 (ruby_2_2): merge revision(s) 54169: [Backport #12189]
usa 2016-04-22 18:20:38 +0900 (Fri, 22 Apr 2016) New Revision: 54694 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54694 Log: merge revision(s) 54169: [Backport #12189] * ext/date/date_core.c (datetime_to_time): preserve timezone info [Bug #12189] [Fix GH-1295] Modified directories: branches/ruby_2_2/ Modified files: branches/ruby_2_2/ChangeLog branches/ruby_2_2/ext/date/date_core.c branches/ruby_2_2/test/date/test_date_conv.rb branches/ruby_2_2/version.h Index: ruby_2_2/ext/date/date_core.c =================================================================== --- ruby_2_2/ext/date/date_core.c (revision 54693) +++ ruby_2_2/ext/date/date_core.c (revision 54694) @@ -8581,21 +8581,24 @@ date_to_datetime(VALUE self) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L8581 static VALUE datetime_to_time(VALUE self) { - volatile VALUE dup = dup_obj_with_new_offset(self, 0); + volatile VALUE dup = dup_obj(self); { VALUE t; get_d1(dup); - t = f_utc6(rb_cTime, + t = rb_funcall(rb_cTime, + rb_intern("new"), + 7, 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))); - return f_getlocal(t); + m_sf_in_sec(dat)), + INT2FIX(m_of(dat))); + return t; } } Index: ruby_2_2/ChangeLog =================================================================== --- ruby_2_2/ChangeLog (revision 54693) +++ ruby_2_2/ChangeLog (revision 54694) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1 +Fri Apr 22 18:19:32 2016 Naotoshi Seo <sonots@g...> + + * 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 <naruse@r...> * lib/securerandom.rb (gen_random): to avoid blocking on Windows. Index: ruby_2_2/test/date/test_date_conv.rb =================================================================== --- ruby_2_2/test/date/test_date_conv.rb (revision 54693) +++ ruby_2_2/test/date/test_date_conv.rb (revision 54694) @@ -31,12 +31,10 @@ class TestDateConv < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/date/test_date_conv.rb#L31 end def test_to_time__from_datetime - d = DateTime.new(2004, 9, 19, 1, 2, 3, 9.to_r/24) + 456789.to_r/86400000000 + d = DateTime.new(2004, 9, 19, 1, 2, 3, 8.to_r/24) + 456789.to_r/86400000000 t = d.to_time - 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 + 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]) d = DateTime.new(2004, 9, 19, 1, 2, 3, 0) + 456789.to_r/86400000000 t = d.to_time.utc Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 54693) +++ ruby_2_2/version.h (revision 54694) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.5" #define RUBY_RELEASE_DATE "2016-04-22" -#define RUBY_PATCHLEVEL 308 +#define RUBY_PATCHLEVEL 309 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 4 Property changes on: ruby_2_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r54169 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/