From bc3d736f4359bf84800008c2c9480e19839fd60a Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 3 Sep 2013 03:10:41 +0000 Subject: * process.c (rb_clock_gettime): Support times() based monotonic clock. (rb_clock_getres): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_process.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/ruby/test_process.rb') diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 8b15679671..fa69d4b916 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -1693,6 +1693,16 @@ EOS assert_kind_of(Float, t, "Process.clock_gettime(:#{n})") end + def test_clock_gettime_TIMES_BASED_CLOCK_MONOTONIC + n = :TIMES_BASED_CLOCK_MONOTONIC + begin + t = Process.clock_gettime(n) + rescue Errno::EINVAL + return + end + assert_kind_of(Float, t, "Process.clock_gettime(:#{n})") + end + def test_clock_gettime_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID n = :GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID begin @@ -1761,6 +1771,18 @@ EOS assert_equal(1000000000, Process.clock_getres(n, :nanosecond)) end + def test_clock_getres_TIMES_BASED_CLOCK_MONOTONIC + n = :TIMES_BASED_CLOCK_MONOTONIC + begin + t = Process.clock_getres(n) + rescue Errno::EINVAL + return + end + assert_kind_of(Float, t, "Process.clock_getres(:#{n})") + f = Process.clock_getres(n, :hertz) + assert_equal(0, f - f.floor) + end + def test_clock_getres_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID n = :GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID begin -- cgit v1.2.3