Sha256: 6da0756b1b176914b79beaeafc527dbd31e75278f4a59b636e3166c2ed96b943

Contents?: true

Size: 540 Bytes

Versions: 10

Compression:

Stored size: 540 Bytes

Contents

require 'cucumber/core/test/result'

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

        def duration
          Result::Duration.new(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

10 entries across 10 versions & 1 rubygems

Version Path
cucumber-core-1.4.0 lib/cucumber/core/test/timer.rb
cucumber-core-1.3.1 lib/cucumber/core/test/timer.rb
cucumber-core-1.3.0 lib/cucumber/core/test/timer.rb
cucumber-core-1.2.0 lib/cucumber/core/test/timer.rb
cucumber-core-1.1.3 lib/cucumber/core/test/timer.rb
cucumber-core-1.1.2 lib/cucumber/core/test/timer.rb
cucumber-core-1.1.1 lib/cucumber/core/test/timer.rb
cucumber-core-1.1.0 lib/cucumber/core/test/timer.rb
cucumber-core-1.0.0 lib/cucumber/core/test/timer.rb
cucumber-core-1.0.0.beta.4 lib/cucumber/core/test/timer.rb