Module: Zxcvbn::Clock Private

Defined in:
lib/zxcvbn/clock.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Monotonic-clock utility for measuring elapsed time.

Class Method Summary collapse

Class Method Details

.realtime { ... } ⇒ Float

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Yields to the block and returns the elapsed time in seconds.

Yields:

  • block whose execution time is measured

Returns:

  • (Float)

    elapsed seconds as a monotonic-clock duration



11
12
13
14
15
# File 'lib/zxcvbn/clock.rb', line 11

def self.realtime
  start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  yield
  Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
end