Skip to content

Commit

Permalink
Merge pull request #51 from ifad/chore/use-monotonic-clock
Browse files Browse the repository at this point in the history
Use monotonic clock to calculate elapsed time
  • Loading branch information
tagliala authored Jan 22, 2024
2 parents d348cb5 + a9da36e commit 597571e
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 597571e

Please sign in to comment.