def timer(&block)
      start_time = Time.now
      yield(start_time)
      time_elapsed = Time.now - start_time
    end
def timer(&block)
      start_time = Time.now
      yield(start_time)
      time_elapsed = Time.now - start_time
    end
Calculate time elapsed when running block.
 @api private
 @yield called while running timer
 @yieldparam start_time [Time]
 @raise [Exception] any exception raised in block
 @return [Float] time elapsed while running block