Class: Ark::Timer
- Inherits:
-
Object
- Object
- Ark::Timer
- 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
-
.reset ⇒ Object
Reset the timer start time to now.
-
.time ⇒ Object
Return the time in seconds from the last call to #reset, or from the beginning of program execution.
Class Method Details
.reset ⇒ Object
Reset the timer start time to now
28 29 30 |
# File 'lib/ark/utility.rb', line 28 def self.reset() @@start = Time.now end |
.time ⇒ Object
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 |