Check by integer modulo instead of float string

This commit is contained in:
Nobuyoshi Nakada 2023-10-03 14:27:51 +09:00
parent 2dee2662d8
commit 8be9138de2
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465

View File

@ -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