1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/spec/ruby/core/process/fixtures/clocks.rb
Benoit Daloze 5b48686691 Remove Process.clock_getres "matches the resolution in practice" specs
* Almost all platforms return incorrect values for Process.clock_getres,
  it should be removed: https://bugs.ruby-lang.org/issues/16740
2020-03-28 12:49:28 +01:00

18 lines
486 B
Ruby

module ProcessSpecs
def self.clock_constants
clocks = []
platform_is_not :windows, :solaris do
clocks += Process.constants.select { |c| c.to_s.start_with?('CLOCK_') }
# These require CAP_WAKE_ALARM and are not documented in
# Process#clock_gettime. They return EINVAL if the permission
# is not granted.
clocks -= [:CLOCK_BOOTTIME_ALARM, :CLOCK_REALTIME_ALARM]
end
clocks.sort.map { |c|
[c, Process.const_get(c)]
}
end
end