[前][次][番号順一覧][スレッド一覧]

ruby-changes:31404

From: usa <ko1@a...>
Date: Thu, 31 Oct 2013 23:06:59 +0900 (JST)
Subject: [ruby-changes:31404] usa:r43483 (ruby_1_9_3): merge revision(s) 43177, 43191: [Backport #8991]

usa	2013-10-31 23:06:50 +0900 (Thu, 31 Oct 2013)

  New Revision: 43483

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43483

  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_1_9_3/
  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/lib/time.rb
    branches/ruby_1_9_3/test/test_time.rb
    branches/ruby_1_9_3/version.h
Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 43482)
+++ ruby_1_9_3/ChangeLog	(revision 43483)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1
+Thu Oct 31 23:05:33 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 31 23:05:33 2013  Tanaka Akira  <akr@f...>
+
+	* lib/time.rb (Time.strptime): Use :offset.
+	  Patch by Felipe Contreras.  [ruby-core:57694]
+
 Thu Oct 31 22:49:56 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* io.c (rb_io_close_read): duplex IO should wait its child process
Index: ruby_1_9_3/lib/time.rb
===================================================================
--- ruby_1_9_3/lib/time.rb	(revision 43482)
+++ ruby_1_9_3/lib/time.rb	(revision 43483)
@@ -282,7 +282,11 @@ class Time https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/lib/time.rb#L282
       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_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 43482)
+++ ruby_1_9_3/version.h	(revision 43483)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 471
+#define RUBY_PATCHLEVEL 472
 
 #define RUBY_RELEASE_DATE "2013-10-31"
 #define RUBY_RELEASE_YEAR 2013
Index: ruby_1_9_3/test/test_time.rb
===================================================================
--- ruby_1_9_3/test/test_time.rb	(revision 43482)
+++ ruby_1_9_3/test/test_time.rb	(revision 43483)
@@ -393,6 +393,8 @@ class TestTimeExtension < Test::Unit::Te https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/test_time.rb#L393
   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_1_9_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r43177,43191


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]