Class: Actor::Statistics::Timer

Inherits:
Object
  • Object
show all
Defined in:
lib/actor/statistics/timer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clockObject



8
9
10
# File 'lib/actor/statistics/timer.rb', line 8

def clock
  @clock ||= Time
end

#start_timeObject

Returns the value of attribute start_time.



5
6
7
# File 'lib/actor/statistics/timer.rb', line 5

def start_time
  @start_time
end

#stop_timeObject

Returns the value of attribute stop_time.



6
7
8
# File 'lib/actor/statistics/timer.rb', line 6

def stop_time
  @stop_time
end

Instance Method Details

#resetObject



12
13
14
15
16
17
# File 'lib/actor/statistics/timer.rb', line 12

def reset
  self.stop_time = nil
  self.start_time = clock.now

  start_time
end

#stopObject



19
20
21
22
23
# File 'lib/actor/statistics/timer.rb', line 19

def stop
  self.stop_time = stop_time = clock.now

  return start_time, stop_time
end