Skip to content

Commit

Permalink
Use monotonic clock to calculate elapsed time
Browse files Browse the repository at this point in the history
  • Loading branch information
tagliala committed Jan 22, 2024
1 parent d348cb5 commit a9da36e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/hawk/http/instrumentation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def instrument(type, payload)
if Hawk::HTTP::Instrumentation.suppress_verbose_output
yield payload
else
start = Time.now.to_f
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
ret = yield payload
elapsed = (Time.now.to_f - start) * 1000
elapsed = (Process.clock_gettime(Process::CLOCK_MONOTONIC) - start) * 1000

url = payload[:url].to_s
if payload[:params].present?
Expand Down

0 comments on commit a9da36e

Please sign in to comment.