Class: Ark::Timer

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

Overview

A stopwatch-like timer

Constant Summary collapse

Conf =

Configuration details for Ark::Timer. Settings:

:round

Number of places to round the returned time to

{}

Class Method Summary collapse

Class Method Details

.resetObject

Reset the timer start time to now



28
29
30
# File 'lib/ark/utility.rb', line 28

def self.reset()
  @@start = Time.now
end

.timeObject

Return the time in seconds from the last call to #reset, or from the beginning of program execution



34
35
36
37
# File 'lib/ark/utility.rb', line 34

def self.time()
  t = Time.now - @@start
  t.round(Conf[:round]).to_s.ljust(5,'0')
end