ruby-changes:31142
From: nagachika <ko1@a...>
Date: Thu, 10 Oct 2013 00:07:53 +0900 (JST)
Subject: [ruby-changes:31142] nagachika:r43221 (ruby_2_0_0): merge revision(s) 43177, 43191: [Backport #8991]
nagachika 2013-10-10 00:07:45 +0900 (Thu, 10 Oct 2013) New Revision: 43221 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43221 Log: merge revision(s) 43177,43191: [Backport #8991] * lib/time.rb (Time.strptime): Use :offset. Patch by Felipe Contreras. [ruby-core:57694] * lib/time.rb (Time.strptime): Time.strptime('0', '%s') returns local time Time object as Ruby 2.0 and before. Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/lib/time.rb branches/ruby_2_0_0/test/test_time.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 43220) +++ ruby_2_0_0/ChangeLog (revision 43221) @@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Thu Oct 10 00:00:30 2013 Tanaka Akira <akr@f...> + + * lib/time.rb (Time.strptime): Time.strptime('0', '%s') returns local + time Time object as Ruby 2.0 and before. + +Thu Oct 10 00:00:30 2013 Tanaka Akira <akr@f...> + + * lib/time.rb (Time.strptime): Use :offset. + Patch by Felipe Contreras. [ruby-core:57694] + Wed Oct 9 23:32:37 2013 Koichi Sasada <ko1@a...> * gc.c (rb_gc_disable): do rest_sweep() before disable GC. Index: ruby_2_0_0/lib/time.rb =================================================================== --- ruby_2_0_0/lib/time.rb (revision 43220) +++ ruby_2_0_0/lib/time.rb (revision 43221) @@ -393,7 +393,11 @@ class Time https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/time.rb#L393 d = Date._strptime(date, format) raise ArgumentError, "invalid strptime format - `#{format}'" unless d if seconds = d[:seconds] - Time.at(seconds) + if offset = d[:offset] + Time.at(seconds).localtime(offset) + else + Time.at(seconds) + end else year = d[:year] year = yield(year) if year && block_given? Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 43220) +++ ruby_2_0_0/version.h (revision 43221) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" -#define RUBY_RELEASE_DATE "2013-10-09" -#define RUBY_PATCHLEVEL 327 +#define RUBY_RELEASE_DATE "2013-10-10" +#define RUBY_PATCHLEVEL 328 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 10 -#define RUBY_RELEASE_DAY 9 +#define RUBY_RELEASE_DAY 10 #include "ruby/version.h" Index: ruby_2_0_0/test/test_time.rb =================================================================== --- ruby_2_0_0/test/test_time.rb (revision 43220) +++ ruby_2_0_0/test/test_time.rb (revision 43221) @@ -400,6 +400,8 @@ class TestTimeExtension < Test::Unit::Te https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/test_time.rb#L400 def test_strptime assert_equal(Time.utc(2005, 8, 28, 06, 54, 20), Time.strptime("28/Aug/2005:06:54:20 +0000", "%d/%b/%Y:%T %z")) assert_equal(Time.at(1).localtime, Time.strptime("1", "%s")) + assert_equal(false, Time.strptime('0', '%s').utc?) + assert_equal(3600, Time.strptime('0 +0100', '%s %z').utc_offset) end def test_nsec Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r43177,43191 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/