Module: Clock::ElapsedMilliseconds

Extended by:
ElapsedMilliseconds
Included in:
Clock, ElapsedMilliseconds
Defined in:
lib/clock/clock.rb

Instance Method Summary collapse

Instance Method Details

#elapsed_milliseconds(start_time, end_time = nil, system_time: nil) ⇒ Object



103
104
105
106
107
108
109
110
# File 'lib/clock/clock.rb', line 103

def elapsed_milliseconds(start_time, end_time=nil, system_time: nil)
  end_time ||= now(system_time: system_time)

  start_time = parse(start_time) if start_time.is_a? String
  end_time = parse(end_time) if end_time.is_a? String

  ((end_time - start_time) * 1000).round
end