2019-04-27 12:53:23 -04:00
|
|
|
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
|
2019-04-28 08:35:17 -04:00
|
|
|
# Process#clock_gettime. They return EINVAL if the permission
|
2019-04-27 12:53:23 -04:00
|
|
|
# is not granted.
|
|
|
|
clocks -= [:CLOCK_BOOTTIME_ALARM, :CLOCK_REALTIME_ALARM]
|
|
|
|
end
|
|
|
|
|
2019-06-27 15:02:36 -04:00
|
|
|
clocks.sort.map { |c|
|
2019-04-28 08:36:03 -04:00
|
|
|
[c, Process.const_get(c)]
|
|
|
|
}
|
2019-04-27 12:53:23 -04:00
|
|
|
end
|
|
|
|
end
|