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 = local_time(from)
  time = round_to_seconds(time)
  # start at the previous second
  time = time - 1
  loop do
    unless date_match?(time)
      time -= time.hour * 3600 + time.min * 60 + time.sec + 1; next
    end
    unless sub_match?(time, :hour, @hours)
      time -= time.min * 60 + time.sec + 1; next
    end
    unless sub_match?(time, :min, @minutes)
      time -= time.sec + 1; next
    end
    unless sub_match?(time, :sec, @seconds)
      time -= 1; next
    end
    break
  end
  global_time(time, from.utc?)
end