Skip to content

Commit

Permalink
Check by integer modulo instead of float string
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Oct 3, 2023
1 parent 2dee266 commit 8be9138
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec/ruby/core/process/times_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit 8be9138

Please sign in to comment.