summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-03 03:10:41 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-03 03:10:41 +0000
commitbc3d736f4359bf84800008c2c9480e19839fd60a (patch)
tree46a838213abcc6e516eb33cbc152a25305e6af75 /test
parentc048ad23b692785c7a5f56d5707205c1830d28e3 (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')
-rw-r--r--test/ruby/test_process.rb22
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