Module: ShellTastic::Timer
- Defined in:
- lib/shelltastic/timer.rb
Class Method Summary collapse
-
.start ⇒ Time
Creates a start time object.
-
.stop ⇒ Time
Creates a stop time object.
-
.total_time(milliseconds = false) ⇒ Time
Calculates the total time elapsed.
Class Method Details
.start ⇒ Time
Creates a start time object
7 8 9 |
# File 'lib/shelltastic/timer.rb', line 7 def start @start = Time.now end |
.stop ⇒ Time
Creates a stop time object
14 15 16 |
# File 'lib/shelltastic/timer.rb', line 14 def stop @stop = Time.now end |
.total_time(milliseconds = false) ⇒ Time
Calculates the total time elapsed
23 24 25 26 27 28 29 |
# File 'lib/shelltastic/timer.rb', line 23 def total_time(milliseconds = false) if milliseconds (@stop - @start) * 1000.0 else @stop - @start end end |