lib/asciidoctor/timings.rb in asciidoctor-1.5.8 vs lib/asciidoctor/timings.rb in asciidoctor-2.0.0.rc.1
- old
+ new
@@ -1,6 +1,6 @@
-# encoding: UTF-8
+# frozen_string_literal: true
module Asciidoctor
class Timings
def initialize
@log = {}
@timers = {}
@@ -52,10 +52,12 @@
to.puts %( Time to read and parse source: #{'%05.5f' % read_parse.to_f})
to.puts %( Time to convert document: #{'%05.5f' % convert.to_f})
to.puts %( Total time (read, parse and convert): #{'%05.5f' % read_parse_convert.to_f})
end
- if (::Process.const_defined? :CLOCK_MONOTONIC) && (::Process.respond_to? :clock_gettime)
+ private
+
+ if (::Process.const_defined? :CLOCK_MONOTONIC, false) && (defined? ::Process.clock_gettime) == 'method'
CLOCK_ID = ::Process::CLOCK_MONOTONIC
def now
::Process.clock_gettime CLOCK_ID
end
else