Sha256: c3c8b42a9b7a517f10382b8f9df49f354c132c173a6c00e91c5089e8243b2df7
Contents?: true
Size: 623 Bytes
Versions: 8
Compression:
Stored size: 623 Bytes
Contents
# frozen_string_literal: true module Mongoid # @api private module Utils # This function should be used if you need to measure time. # @example Calculate elapsed time. # starting = Utils.monotonic_time # # do something time consuming # ending = Utils.monotonic_time # puts "It took #{(ending - starting).to_i} seconds" # # @see https://blog.dnsimple.com/2018/03/elapsed-time-with-ruby-the-right-way/ # # @return [Float] seconds according to monotonic clock module_function def monotonic_time Process.clock_gettime(Process::CLOCK_MONOTONIC) end end end
Version data entries
8 entries across 8 versions & 1 rubygems