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

ruby-changes:14808

From: akr <ko1@a...>
Date: Mon, 15 Feb 2010 22:21:27 +0900 (JST)
Subject: [ruby-changes:14808] Ruby:r26670 (trunk): * time.c (time_add): propagate fixed time offset.

akr	2010-02-15 22:21:10 +0900 (Mon, 15 Feb 2010)

  New Revision: 26670

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

  Log:
    * time.c (time_add): propagate fixed time offset.

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

Index: time.c
===================================================================
--- time.c	(revision 26669)
+++ time.c	(revision 26670)
@@ -2909,6 +2909,11 @@
 	GetTimeval(result, tobj);
         TIME_SET_UTC(tobj);
     }
+    else if (TIME_FIXOFF_P(tobj)) {
+        VALUE off = tobj->vtm.utc_offset;
+        GetTimeval(result, tobj);
+        TIME_SET_FIXOFF(tobj, off);
+    }
     return result;
 }
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 26669)
+++ ChangeLog	(revision 26670)
@@ -1,3 +1,7 @@
+Mon Feb 15 22:18:49 2010  Tanaka Akira  <akr@f...>
+
+	* time.c (time_add): propagate fixed time offset.
+
 Mon Feb 15 17:42:20 2010  NARUSE, Yui  <naruse@r...>
 
 	* signal.c (USE_SIGALTSTACK): NetBSD can't use sigaltstack(2)
Index: test/ruby/test_time.rb
===================================================================
--- test/ruby/test_time.rb	(revision 26669)
+++ test/ruby/test_time.rb	(revision 26670)
@@ -27,6 +27,16 @@
     assert_equal(Time.utc(2000, 3, 21, 3, 30) + (-3 * 3600),
                  Time.utc(2000, 3, 21, 0, 30))
     assert_equal(0, (Time.at(1.1) + 0.9).usec)
+
+    assert((Time.utc(2000, 4, 1) + 24).utc?)
+    assert(!(Time.local(2000, 4, 1) + 24).utc?)
+
+    t = Time.new(2000, 4, 1, 0, 0, 0, "+01:00") + 24
+    assert(!t.utc?)
+    assert_equal(3600, t.utc_offset)
+    t = Time.new(2000, 4, 1, 0, 0, 0, "+02:00") + 24
+    assert(!t.utc?)
+    assert_equal(7200, t.utc_offset)
   end
 
   def test_time_subt()

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

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