class Rufus::Scheduler::CronLine

def previous_time(from=Time.now)


for the past.
Returns the previous the cronline matched. It's like next_time, but
def previous_time(from=Time.now)
  # looks back by slices of two hours,
  #
  # finds for '* * * * sun', '* * 13 * *' and '0 12 13 * *'
  # starting 1970, 1, 1 in 1.8 to 2 seconds (says Rspec)
  start = current = from - 2 * 3600
  result = nil
  loop do
    nex = next_time(current)
    return (result ? result : previous_time(start)) if nex > from
    result = current = nex
  end
  # never reached
end