summaryrefslogtreecommitdiff
path: root/spec/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-10-03 14:27:51 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-10-03 14:27:51 +0900
commit8be9138de2f9c6ce418f43ee55f5e6bce645bc28 (patch)
treeccb2a71b2cd68c338076d20f19a41e9336d41f5b /spec/ruby
parent2dee2662d8d8b54a21c18c584a3f6ed319eb8eb5 (diff)
Check by integer modulo instead of float string
Diffstat (limited to 'spec/ruby')
-rw-r--r--spec/ruby/core/process/times_spec.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/ruby/core/process/times_spec.rb b/spec/ruby/core/process/times_spec.rb
index d2610f6415..9e16c36b7a 100644
--- a/spec/ruby/core/process/times_spec.rb
+++ b/spec/ruby/core/process/times_spec.rb
@@ -26,8 +26,8 @@ describe "Process.times" do
# If getrusage has precision beyond milliseconds, there will be
# very likely at least one non-zero microsecond results when
# repeating enough.
- time = Process.clock_gettime(:GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID)
- not ('%.6f' % time).end_with?('000')
+ time = Process.clock_gettime(:GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID, :nanosecond)
+ not (time % 1_000_000) == 0
end
rescue Errno::EINVAL
false