# File lib/rufus/scheduler/zotime.rb, line 229
    def self.parse(str, opts={})

      if defined?(::Chronic) && t = ::Chronic.parse(str, opts)
        return ZoTime.new(t, nil)
      end

      #rold = RUBY_VERSION < '1.9.0'
      #rold = RUBY_VERSION < '2.0.0'

      begin
        DateTime.parse(str)
      rescue
        fail ArgumentError, "no time information in #{str.inspect}"
      end #if rold
        #
        # is necessary since Time.parse('xxx') in Ruby < 1.9 yields `now`

      zone = nil

      s =
        str.gsub(/\S+/) do |w|
          if z = get_tzone(w)
            zone ||= z
            ''
          else
            w
          end
        end

      local = Time.parse(s)
      izone = extract_iso8601_zone(s)

      zone ||=
        if s.match(/\dZ\b/)
          get_tzone('Zulu')
        #elsif rold && izone
        elsif izone
          get_tzone(izone)
        elsif local.zone.nil? && izone
          get_tzone(local.strftime('%:z'))
        else
          get_tzone(:local)
        end

      secs =
        #if rold && izone
        if izone
          local.to_f
        else
          zone.period_for_local(local).to_utc(local).to_f
        end

      ZoTime.new(secs, zone)
    end