class Fugit::Cron

def next_time(from=::EtOrbi::EoTime.now)

def next_time(from=::EtOrbi::EoTime.now)
  from = ::EtOrbi.make_time(from)
  sfrom = from.strftime('%F|%T')
  ifrom = from.to_i
  i = 0
  t = TimeCursor.new(self, from.translate(@timezone))
    #
    # the translation occurs in the timezone of
    # this Fugit::Cron instance
  loop do
    fail RuntimeError.new(
      "too many loops for #{@original.inspect} #next_time, breaking, " +
      "please fill an issue at https://git.io/fjJC9"
    ) if (i += 1) > MAX_ITERATION_COUNT
    (ifrom == t.to_i) && (t.inc(1); next)
    month_match?(t) || (t.inc_month; next)
    day_match?(t) || (t.inc_day; next)
    hour_match?(t) || (t.inc_hour; next)
    min_match?(t) || (t.inc_min; next)
    sec_match?(t) || (t.inc_sec; next)
    st = t.time.strftime('%F|%T')
    (from, sfrom, ifrom = t.time, st, t.to_i; next) if st == sfrom
      #
      # when transitioning out of DST, this prevents #next_time from
      # yielding the same literal time twice in a row, see gh-6
    break
  end
  t.time.translate(from.zone)
    #
    # the answer time is in the same timezone as the `from`
    # starting point
end