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

ruby-changes:21741

From: akr <ko1@a...>
Date: Sat, 19 Nov 2011 19:47:17 +0900 (JST)
Subject: [ruby-changes:21741] akr:r33790 (trunk): * time.c (TIME_COPY_GMT): copy vtm.utc_offset and vtm.zone too.

akr	2011-11-19 19:47:03 +0900 (Sat, 19 Nov 2011)

  New Revision: 33790

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

  Log:
    * time.c (TIME_COPY_GMT): copy vtm.utc_offset and vtm.zone too.
      patch by Tomoyuki Chikanaga.
      [ruby-dev:44827] [Bug #5586]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_time.rb
    trunk/time.c

Index: time.c
===================================================================
--- time.c	(revision 33789)
+++ time.c	(revision 33790)
@@ -1820,7 +1820,10 @@
      (tobj)->vtm.utc_offset = (off), \
      (tobj)->vtm.zone = NULL)
 
-#define TIME_COPY_GMT(tobj1, tobj2) ((tobj1)->gmt = (tobj2)->gmt)
+#define TIME_COPY_GMT(tobj1, tobj2) \
+    ((tobj1)->gmt = (tobj2)->gmt, \
+     (tobj1)->vtm.utc_offset = (tobj2)->vtm.utc_offset, \
+     (tobj1)->vtm.zone = (tobj2)->vtm.zone)
 
 static VALUE time_get_tm(VALUE, struct time_object *);
 #define MAKE_TM(time, tobj) \
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33789)
+++ ChangeLog	(revision 33790)
@@ -1,3 +1,9 @@
+Sat Nov 19 19:31:47 2011  Tanaka Akira  <akr@f...>
+
+	* time.c (TIME_COPY_GMT): copy vtm.utc_offset and vtm.zone too.
+	  patch by Tomoyuki Chikanaga.
+	  [ruby-dev:44827] [Bug #5586]
+
 Sat Nov 19 16:36:57 2011  Tanaka Akira  <akr@f...>
 
 	* test/net/http/test_http.rb: remove temporally files in ensure clause.
Index: test/ruby/test_time.rb
===================================================================
--- test/ruby/test_time.rb	(revision 33789)
+++ test/ruby/test_time.rb	(revision 33790)
@@ -278,6 +278,13 @@
     assert_equal(29700, t2.utc_offset, bug)
   end
 
+  def test_marshal_to_s
+    t1 = Time.new(2011,11,8, 0,42,25, 9*3600)
+    t2 = Time.at(Marshal.load(Marshal.dump(t1)))
+    assert_equal("2011-11-08 00:42:25 +0900", t2.to_s,
+      "[ruby-dev:44827] [Bug #5586]")
+  end
+
   # Sat Jan 01 00:00:00 UTC 2000
   T2000 = Time.at(946684800).gmtime
 

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

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