Module: Mongoid::Utils Private

Defined in:
build/mongoid-8.1/lib/mongoid/utils.rb

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.

Class Method Summary collapse

Class Method Details

.monotonic_timeFloat

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.

This function should be used if you need to measure time.

Examples:

Calculate elapsed time.

starting = Utils.monotonic_time
# do something time consuming
ending = Utils.monotonic_time
puts "It took #{(ending - starting).to_i} seconds"

Returns:

  • (Float)

    seconds according to monotonic clock

See Also:



18
19
20
# File 'build/mongoid-8.1/lib/mongoid/utils.rb', line 18

module_function def monotonic_time
  Process.clock_gettime(Process::CLOCK_MONOTONIC)
end