aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--test/ruby/test_time.rb6
-rw-r--r--time.c2
3 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index addbbf30b5..1193f82c74 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sun May 4 16:04:28 2008 Tanaka Akira <akr@fsij.org>
+
+ * time.c (obj2nsec): fix string argument.
+
Sun May 4 14:29:14 2008 Tanaka Akira <akr@fsij.org>
* eval.c (rb_obj_respond_to): check the result of respond_to? method
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index 452e22f919..9cbb6eaca6 100644
--- a/test/ruby/test_time.rb
+++ b/test/ruby/test_time.rb
@@ -64,6 +64,12 @@ class TestTime < Test::Unit::TestCase
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]")
diff --git a/time.c b/time.c
index 460a184507..0107c6a033 100644
--- a/time.c
+++ b/time.c
@@ -356,7 +356,7 @@ obj2nsec(VALUE obj, long *nsec)
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);