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

ruby-changes:4792

From: ko1@a...
Date: Sun, 4 May 2008 16:05:41 +0900 (JST)
Subject: [ruby-changes:4792] akr - Ruby:r16286 (trunk): * time.c (obj2nsec): fix string argument.

akr	2008-05-04 16:05:26 +0900 (Sun, 04 May 2008)

  New Revision: 16286

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

  Log:
    * time.c (obj2nsec): fix string argument.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/time.c?r1=16286&r2=16285&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16286&r2=16285&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_time.rb?r1=16286&r2=16285&diff_format=u

Index: time.c
===================================================================
--- time.c	(revision 16285)
+++ time.c	(revision 16286)
@@ -356,7 +356,7 @@
     if (TYPE(obj) == T_STRING) {
 	obj = rb_str_to_inum(obj, 10, Qfalse);
         *nsec = 0;
-        return NUM2LONG(obj) * 1000;
+        return NUM2LONG(obj);
     }
 
     ts = time_timespec(obj, 1);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 16285)
+++ ChangeLog	(revision 16286)
@@ -1,3 +1,7 @@
+Sun May  4 16:04:28 2008  Tanaka Akira  <akr@f...>
+
+	* time.c (obj2nsec): fix string argument.
+
 Sun May  4 14:29:14 2008  Tanaka Akira  <akr@f...>
 
 	* eval.c (rb_obj_respond_to): check the result of respond_to? method
Index: test/ruby/test_time.rb
===================================================================
--- test/ruby/test_time.rb	(revision 16285)
+++ test/ruby/test_time.rb	(revision 16286)
@@ -64,6 +64,12 @@
     end
   end
 
+  def test_strtime
+    t = nil
+    assert_nothing_raised { t = Time.utc("2000", "1", "2" , "3", "4", "5") }
+    assert_equal(Time.utc(2000,1,2,3,4,5), t)
+  end
+
   def test_huge_difference
     if negative_time_t?
       assert_equal(Time.at(-0x80000000), Time.at(0x7fffffff) - 0xffffffff, "[ruby-dev:22619]")

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

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