diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-03 03:10:41 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-03 03:10:41 +0000 |
commit | bc3d736f4359bf84800008c2c9480e19839fd60a (patch) | |
tree | 46a838213abcc6e516eb33cbc152a25305e6af75 /test/ruby/test_process.rb | |
parent | c048ad23b692785c7a5f56d5707205c1830d28e3 (diff) |
* 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
Diffstat (limited to 'test/ruby/test_process.rb')
-rw-r--r-- | test/ruby/test_process.rb | 22 |
1 files changed, 22 insertions, 0 deletions
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 |