diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-04-27 18:53:23 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-04-27 18:53:23 +0200 |
commit | a1b4816759418ca8fe510e8739622fc5d77ab0f0 (patch) | |
tree | 9d4fb6091d0086817f5bde46bf1150e9130d34fd /spec/ruby/core/process/fixtures | |
parent | 00c33d9c232ed1a79eda17acd7231ac93caa162b (diff) | |
download | ruby-a1b4816759418ca8fe510e8739622fc5d77ab0f0.tar.gz |
Update to ruby/spec@15c9619
Diffstat (limited to 'spec/ruby/core/process/fixtures')
-rw-r--r-- | spec/ruby/core/process/fixtures/clocks.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/ruby/core/process/fixtures/clocks.rb b/spec/ruby/core/process/fixtures/clocks.rb new file mode 100644 index 0000000000..5f45e8065b --- /dev/null +++ b/spec/ruby/core/process/fixtures/clocks.rb @@ -0,0 +1,24 @@ +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] + + # These clocks in practice on Linux do not seem to match + # their reported resolution. + clocks -= [:CLOCK_REALTIME_COARSE, :CLOCK_MONOTONIC_COARSE] + + clocks.map! { |c| + [c, Process.const_get(c)] + } + end + + clocks + end +end |