# File lib/rufus/scheduler/util.rb, line 125
    def self.parse_duration(string, opts={})

      s = string.to_s.strip
      mod = s[0, 1] == '-' ? -1 : 1
      s = s[1..-1] if mod == -1

      ss = mod < 0 ? '-' : ''
      r = 0.0

      s.scan(/(\d*\.\d+|\d+\.?)([#{DURATION_LETTERS}]?)/) do |f, d|
        ss += "#{f}#{d}"
        r += f.to_f * (DURATIONS[d] || 1.0)
      end

      if ss == '-' || ss != string.to_s.strip
        return nil if opts[:no_error]
        fail ArgumentError.new("invalid time duration #{string.inspect}")
      end

      mod * r
    end