summaryrefslogtreecommitdiff
path: root/spec/ruby/core/process/fixtures/clocks.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/process/fixtures/clocks.rb')
-rw-r--r--spec/ruby/core/process/fixtures/clocks.rb22
1 files changed, 18 insertions, 4 deletions
diff --git a/spec/ruby/core/process/fixtures/clocks.rb b/spec/ruby/core/process/fixtures/clocks.rb
index 5d6edebfc9..c8f81fa4c3 100644
--- a/spec/ruby/core/process/fixtures/clocks.rb
+++ b/spec/ruby/core/process/fixtures/clocks.rb
@@ -9,14 +9,28 @@ module ProcessSpecs
# Process#clock_gettime. They return EINVAL if the permission
# is not granted.
clocks -= [:CLOCK_BOOTTIME_ALARM, :CLOCK_REALTIME_ALARM]
-
- # These clocks in practice on Linux do not seem to match
- # their reported resolution.
- clocks -= [:CLOCK_REALTIME_COARSE, :CLOCK_MONOTONIC_COARSE]
end
clocks.map { |c|
[c, Process.const_get(c)]
}
end
+
+ def self.clock_constants_for_resolution_checks
+ clocks = clock_constants
+
+ # These clocks in practice on Linux do not seem to match their reported resolution.
+ clocks = clocks.reject { |clock, value|
+ [:CLOCK_REALTIME_COARSE, :CLOCK_MONOTONIC_COARSE].include?(clock)
+ }
+
+ # These clocks in practice on ARM on Linux do not seem to match their reported resolution.
+ platform_is :armv7l, :aarch64 do
+ clocks = clocks.reject { |clock, value|
+ [:CLOCK_PROCESS_CPUTIME_ID, :CLOCK_THREAD_CPUTIME_ID, :CLOCK_MONOTONIC_RAW].include?(clock)
+ }
+ end
+
+ clocks
+ end
end