Method: Fluent::Config.time_value
- Defined in:
- lib/fluent/config/types.rb
.time_value(str, opts = {}, name = nil) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/fluent/config/types.rb', line 44 def self.time_value(str, opts = {}, name = nil) return nil if str.nil? case str.to_s when /([0-9]+)s/ $~[1].to_i when /([0-9]+)m/ $~[1].to_i * 60 when /([0-9]+)h/ $~[1].to_i * 60 * 60 when /([0-9]+)d/ $~[1].to_i * 24 * 60 * 60 else FLOAT_TYPE.call(str, opts, name) end end |