summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-31 06:05:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-31 06:05:43 +0000
commitcf990c5acebae71976099807c678a8173511352c (patch)
tree5100b08d8181eafdfdf5c0c01e42985c043aab82 /lib
parentd723b930387e992a1d632a5d20052c789f229d41 (diff)
benchmark.rb: Process::CLOCK_MONOTONIC_RAW may be unavailable
* lib/benchmark.rb (BENCHMARK_CLOCK): Process::CLOCK_MONOTONIC_RAW is not supported on old linux. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/benchmark.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/benchmark.rb b/lib/benchmark.rb
index 87666a61ea..f6dac66870 100644
--- a/lib/benchmark.rb
+++ b/lib/benchmark.rb
@@ -272,7 +272,8 @@ module Benchmark
# :stopdoc:
case
- when defined?(Process::CLOCK_MONOTONIC_RAW)
+ when defined?(Process::CLOCK_MONOTONIC_RAW) and
+ (Process.clock_gettime(Process::CLOCK_MONOTONIC_RAW) rescue false)
BENCHMARK_CLOCK = Process::CLOCK_MONOTONIC_RAW
when defined?(Process::CLOCK_MONOTONIC)
BENCHMARK_CLOCK = Process::CLOCK_MONOTONIC