Sha256: 6f19dfd423883613464faa931bb1d4239851fac5ccfb0b5f8e14094e08d3f79a

Contents?: true

Size: 481 Bytes

Versions: 5

Compression:

Stored size: 481 Bytes

Contents

module Cucumber
  module Core
    module Test
      class Timer
        def start
          @start_time = time_in_nanoseconds
          self
        end

        def duration
          nsec
        end

        def nsec
          time_in_nanoseconds - @start_time
        end

        def sec
          nsec / 10 ** 9.0
        end

        private

        def time_in_nanoseconds
          t = Time.now
          t.to_i * 10 ** 9 + t.nsec
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cucumber-core-1.0.0.beta.3 lib/cucumber/core/test/timer.rb
cucumber-core-1.0.0.beta.2 lib/cucumber/core/test/timer.rb
cucumber-core-1.0.0.beta.1 lib/cucumber/core/test/timer.rb
cucumber-core-0.2.0 lib/cucumber/core/test/timer.rb
cucumber-core-0.1.0 lib/cucumber/core/test/timer.rb