* time.c (time_to_r): convert to rational if internal representation

is not rational.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-01-13 23:51:16 +00:00
parent 49ab7b4238
commit 4bf4ddb693
3 changed files with 16 additions and 1 deletions

View file

@ -540,4 +540,9 @@ class TestTime < Test::Unit::TestCase
assert_equal(-1, d1 <=> d2)
assert_equal(1, d2 <=> d1)
end
def test_to_r
assert_kind_of(Rational, Time.new(2000,1,1,0,0,Rational(4,3)).to_r)
assert_kind_of(Rational, Time.utc(1970).to_r)
end
end