Skip to content

Commit 3de4d2a

Browse files
committed
Use clock_gettime(CLOCK_MONOTONIC) insted of Time.now
1 parent c488165 commit 3de4d2a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spec/ruby/library/socket/fixtures/classes.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ def self.each_ip_protocol
7373

7474
def self.loop_with_timeout(timeout = 5)
7575
require 'timeout'
76-
time = Time.now
76+
time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
7777

7878
loop do
79-
if Time.now - time >= timeout
79+
if Process.clock_gettime(Process::CLOCK_MONOTONIC) - time >= timeout
8080
raise TimeoutError, "Did not succeed within #{timeout} seconds"
8181
end
8282

0 commit comments

Comments
 (0)