Skip to content

Commit 66de651

Browse files
committed
Add patches_test/tool-lib-core_assertions.rb.patch
1 parent 3d7b223 commit 66de651

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
diff --git a/tool/lib/core_assertions.rb b/tool/lib/core_assertions.rb
2+
index ede490576c..48e73aeed6 100644
3+
--- a/tool/lib/core_assertions.rb
4+
+++ b/tool/lib/core_assertions.rb
5+
@@ -819,18 +819,22 @@ def assert_all_assertions_foreach(msg = nil, *keys, &block)
6+
end
7+
alias all_assertions_foreach assert_all_assertions_foreach
8+
9+
- %w[
10+
- CLOCK_THREAD_CPUTIME_ID CLOCK_PROCESS_CPUTIME_ID
11+
- CLOCK_MONOTONIC
12+
- ].find do |c|
13+
- if Process.const_defined?(c)
14+
- [c.to_sym, Process.const_get(c)].find do |clk|
15+
- begin
16+
- Process.clock_gettime(clk)
17+
- rescue
18+
- # Constants may be defined but not implemented, e.g., mingw.
19+
- else
20+
- PERFORMANCE_CLOCK = clk
21+
+ if RUBY_PLATFORM.match?(/mswin|mingw/)
22+
+ PERFORMANCE_CLOCK = Process::CLOCK_MONOTONIC
23+
+ else
24+
+ %w[
25+
+ CLOCK_THREAD_CPUTIME_ID CLOCK_PROCESS_CPUTIME_ID
26+
+ CLOCK_MONOTONIC
27+
+ ].find do |c|
28+
+ if Process.const_defined?(c) && !Process.const_get(c).nil?
29+
+ [c.to_sym, Process.const_get(c)].find do |clk|
30+
+ begin
31+
+ Process.clock_gettime(clk)
32+
+ rescue
33+
+ # Constants may be defined but not implemented, e.g., mingw.
34+
+ else
35+
+ PERFORMANCE_CLOCK = clk
36+
+ end
37+
end
38+
end
39+
end

0 commit comments

Comments
 (0)