From 8be9138de2f9c6ce418f43ee55f5e6bce645bc28 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 3 Oct 2023 14:27:51 +0900 Subject: [PATCH] Check by integer modulo instead of float string --- spec/ruby/core/process/times_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/ruby/core/process/times_spec.rb b/spec/ruby/core/process/times_spec.rb index d2610f64157c45..9e16c36b7a3dba 100644 --- a/spec/ruby/core/process/times_spec.rb +++ b/spec/ruby/core/process/times_spec.rb @@ -26,8 +26,8 @@ # 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