Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Process.clock_gettime to measure track execution time #132

Merged
merged 2 commits into from
Nov 21, 2020

Conversation

ArturT
Copy link
Member

@ArturT ArturT commented Nov 21, 2020

problem

Using any variation of Time.now is not a reliable way of measuring elapsed time. It may be affected by jumps in the local clock.

solution

Instead, we can use a more reliable Process.clock_gettime(Process:: CLOCK_MONOTONIC).

For a detailed explanation, please read this blog post: https://blog.dnsimple.com/2018/03/elapsed-time-with-ruby-the-right-way/

Related PR

KnapsackPro/knapsack#100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant