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

ruby-changes:33727

From: akr <ko1@a...>
Date: Sun, 4 May 2014 20:52:30 +0900 (JST)
Subject: [ruby-changes:33727] akr:r45808 (trunk): * lib/time.rb (Time.force_zone!): Use usual local time if it has

akr	2014-05-04 20:52:26 +0900 (Sun, 04 May 2014)

  New Revision: 45808

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

  Log:
    * lib/time.rb (Time.force_zone!): Use usual local time if it has
      expected offset from UTC.

  Modified files:
    trunk/ChangeLog
    trunk/NEWS
    trunk/lib/time.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45807)
+++ ChangeLog	(revision 45808)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun May  4 20:51:32 2014  Tanaka Akira  <akr@f...>
+
+	* lib/time.rb (Time.force_zone!): Use usual local time if it has
+	  expected offset from UTC.
+
 Sun May  4 17:58:12 2014  Tanaka Akira  <akr@f...>
 
 	* lib/time.rb (Time.force_zone!): New private method.
Index: lib/time.rb
===================================================================
--- lib/time.rb	(revision 45807)
+++ lib/time.rb	(revision 45808)
@@ -178,7 +178,10 @@ class Time https://github.com/ruby/ruby/blob/trunk/lib/time.rb#L178
       if zone_utc?(zone)
         t.utc
       elsif offset ||= zone_offset(zone)
-        t.localtime(offset)
+        t.localtime
+        if t.utc_offset != offset
+          t.localtime(offset)
+        end
       else
         t.localtime
       end
Index: NEWS
===================================================================
--- NEWS	(revision 45807)
+++ NEWS	(revision 45808)
@@ -73,8 +73,9 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L73
 === Stdlib compatibility issues (excluding feature bug fixes)
 
 * time.rb
-  * Time.parse, Time.strptime, Time.rfc2822, Time.xmlschema produces
-    fixed-offset Time objects to preserve the offset from UTC.
+  * Time.parse, Time.strptime, Time.rfc2822, Time.xmlschema may produce
+    fixed-offset Time objects.
+    It is happen when usual localtime doesn't preserve the offset from UTC.
   * Time.httpdate produces always UTC Time object.
 
 === Built-in global variables compatibility issues

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

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