class Rufus::Scheduler::CronLine

def previous_time(from=Time.now)


for the past.
Returns the previous time the cronline matched. It's like next_time, but
def previous_time(from=Time.now)
  time = nil
  zotime = ZoTime.new(from.to_i - 1, @timezone || ENV['TZ'])
  loop do
    time = zotime.time
    unless date_match?(time)
      zotime.substract(time.hour * 3600 + time.min * 60 + time.sec + 1)
      next
    end
    unless sub_match?(time, :hour, @hours)
      zotime.substract(time.min * 60 + time.sec + 1)
      next
    end
    unless sub_match?(time, :min, @minutes)
      zotime.substract(time.sec + 1)
      next
    end
    unless sub_match?(time, :sec, @seconds)
      zotime.substract(prev_second(time))
      next
    end
    break
  end
  time
end