Class: CivoCLI::Timer
- Inherits:
-
Object
- Object
- CivoCLI::Timer
- Defined in:
- lib/timer.rb
Instance Attribute Summary collapse
-
#time_elapsed ⇒ Object
Returns the value of attribute time_elapsed.
Instance Method Summary collapse
Instance Attribute Details
#time_elapsed ⇒ Object
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_timer ⇒ Object
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_timer ⇒ Object
6 7 8 |
# File 'lib/timer.rb', line 6 def start_timer @start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) end |