Class: CivoCLI::Timer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#time_elapsedObject

Returns the value of attribute time_elapsed.



4
5
6
# File 'lib/timer.rb', line 4

def time_elapsed
  @time_elapsed
end

Instance Method Details

#end_timerObject



10
11
12
13
14
# File 'lib/timer.rb', line 10

def end_timer
  end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)

  @time_elapsed = (end_time - @start_time).round(2)
end

#start_timerObject



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

def start_timer
  @start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
end