From ad20a9e01ae998e672f4b2c87b100199066eaf17 Mon Sep 17 00:00:00 2001 From: tadf Date: Sat, 9 May 2009 10:28:37 +0000 Subject: * lib/date.rb: use subsec instead of nsec. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/date/test_date_conv.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/date/test_date_conv.rb b/test/date/test_date_conv.rb index 5565ca8e5e..daf0374294 100644 --- a/test/date/test_date_conv.rb +++ b/test/date/test_date_conv.rb @@ -49,6 +49,13 @@ class TestDateConv < Test::Unit::TestCase assert_equal([2004, 9, 19, 1, 2, 3, 456789123], [t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.nsec]) end + + if Time.allocate.respond_to?(:subsec) + d = DateTime.new(2004, 9, 19, 1, 2, 3, 0) + 456789123456789123.to_r/86400000000000000000000 + t = d.to_time.utc + assert_equal([2004, 9, 19, 1, 2, 3, Rational(456789123456789123,1000000000000000000)], + [t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.subsec]) + end end def test_to_date__from_time -- cgit v1.2.3