diff options
| author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-09 10:28:37 +0000 |
|---|---|---|
| committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-09 10:28:37 +0000 |
| commit | e66f0d429f3a4201465f7e1d4f4d4d87d4e4fd24 (patch) | |
| tree | 97d6289f5de5fc05126e4e062b05a4f437ca2665 /test/date | |
| parent | 4f4279c2531024b5bfaf5f5e4205742ad1f75c97 (diff) | |
| download | ruby-e66f0d429f3a4201465f7e1d4f4d4d87d4e4fd24.tar.gz ruby-e66f0d429f3a4201465f7e1d4f4d4d87d4e4fd24.tar.xz ruby-e66f0d429f3a4201465f7e1d4f4d4d87d4e4fd24.zip | |
* lib/date.rb: use subsec instead of nsec.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/date')
| -rw-r--r-- | test/date/test_date_conv.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/date/test_date_conv.rb b/test/date/test_date_conv.rb index 5565ca8e5..daf037429 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 |
