Check by integer modulo instead of float string

This commit is contained in:
Nobuyoshi Nakada 2023-10-03 14:27:51 +09:00
Родитель 2dee2662d8
Коммит 8be9138de2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 3582D74E1FEE4465
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

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