Module: SensuCheckHelpers::Time
- Defined in:
- lib/sensu-check-helpers/time.rb
Instance Method Summary collapse
- #as_seconds(duration) ⇒ Object
- #pretty_time(duration) ⇒ Object
- #time_period_in_seconds(end_time, start_time) ⇒ Object
Instance Method Details
#as_seconds(duration) ⇒ Object
9 10 11 |
# File 'lib/sensu-check-helpers/time.rb', line 9 def as_seconds(duration) ChronicDuration.parse(duration.to_s, :keep_zero => true) end |
#pretty_time(duration) ⇒ Object
13 14 15 |
# File 'lib/sensu-check-helpers/time.rb', line 13 def pretty_time(duration) ChronicDuration.output(duration, :format => :long) end |
#time_period_in_seconds(end_time, start_time) ⇒ Object
5 6 7 |
# File 'lib/sensu-check-helpers/time.rb', line 5 def time_period_in_seconds(end_time, start_time) end_time - start_time end |