mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* time.c (obj2nsec): fix string argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f587eab23c
commit
04752225a7
3 changed files with 11 additions and 1 deletions
|
@ -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>
|
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
|
* eval.c (rb_obj_respond_to): check the result of respond_to? method
|
||||||
|
|
|
@ -64,6 +64,12 @@ class TestTime < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
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
|
def test_huge_difference
|
||||||
if negative_time_t?
|
if negative_time_t?
|
||||||
assert_equal(Time.at(-0x80000000), Time.at(0x7fffffff) - 0xffffffff, "[ruby-dev:22619]")
|
assert_equal(Time.at(-0x80000000), Time.at(0x7fffffff) - 0xffffffff, "[ruby-dev:22619]")
|
||||||
|
|
2
time.c
2
time.c
|
@ -356,7 +356,7 @@ obj2nsec(VALUE obj, long *nsec)
|
||||||
if (TYPE(obj) == T_STRING) {
|
if (TYPE(obj) == T_STRING) {
|
||||||
obj = rb_str_to_inum(obj, 10, Qfalse);
|
obj = rb_str_to_inum(obj, 10, Qfalse);
|
||||||
*nsec = 0;
|
*nsec = 0;
|
||||||
return NUM2LONG(obj) * 1000;
|
return NUM2LONG(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
ts = time_timespec(obj, 1);
|
ts = time_timespec(obj, 1);
|
||||||
|
|
Loading…
Reference in a new issue