lib/httpx/utils.rb in httpx-0.17.0 vs lib/httpx/utils.rb in httpx-0.18.0
- old
+ new
@@ -4,9 +4,17 @@
module Utils
using URIExtensions
module_function
+ def now
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ end
+
+ def elapsed_time(monotonic_timestamp)
+ Process.clock_gettime(Process::CLOCK_MONOTONIC) - monotonic_timestamp
+ end
+
# The value of this field can be either an HTTP-date or a number of
# seconds to delay after the response is received.
def parse_retry_after(retry_after)
# first: bet on it being an integer
Integer(retry_after)