FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use a monotonic clock for calibration by OskarEichler · Pull Request #301 · bcrypt-ruby/bcrypt-ruby · GitHub

Repository navigation

Use a monotonic clock for calibration - #301

Open
OskarEichler wants to merge 1 commit into
bcrypt-ruby:masterfrom
OskarEichler:codex/use-monotonic-calibration
Open

OskarEichler wants to merge 1 commit into
bcrypt-ruby:masterfrom
OskarEichler:codex/use-monotonic-calibration

Conversation

Copy link
Copy Markdown

Summary

Measure BCrypt::Engine.calibrate with Ruby's monotonic process clock instead of the adjustable wall clock.

This keeps elapsed-time measurements stable when NTP, virtualization, or an administrator moves the system clock while calibration is running, and addresses the timing fragility discussed in #235 and #248.

Reproduction

An external focused model replaces Time.now with a method that raises. The current implementation raises from calibrate; this branch returns MIN_COST for a tiny time budget because calibration no longer consults wall time.

Verification

  • bundle exec rake compile spec: 39 examples, 0 failures on Ruby 4.0.6
  • focused wall-clock-isolation model: pass

Compatibility

No public API, cost selection algorithm, or supported platform changes. Process.clock_gettime(Process::CLOCK_MONOTONIC) is available on the supported Ruby versions.

This branch has not been deployed

No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL