clon

API Reference

clon

CLON

  • Variable *DEFAULT-NEXT-TIME-LIMIT*
    (encode-universal-time 0 0 0 1 1 3000)
    The default time limit for NEXT-TIME searches.
  • Generic-Function NEXT-TIME (schedule &key now allow-now-p limit)
    Return the next time according to SCHEDULE or NIL if there is no next time. If ALLOW-NOW-P the earliest possible time to be returned is NOW, else it is usually NOW + the resolution of the schedule. The default value of NOW is (GET-UNIVERSAL-TIME), ALLOW-NOW-P is NIL and LIMIT is *DEFAULT-NEXT-TIME-LIMIT*
  • Function MAKE-SCHEDULER (schedule &key (now (get-universal-time)) allow-now-p (limit *default-next-time-limit*))
    Return a `scheduler' function of no arguments that returns times from NOW on by repeatedly calling NEXT-TIME on SCHEDULE. ALLOW-NOW-P is passed to the first invocation of NEXT-TIME.
  • Function SCHEDULE-FUNCTION (function scheduler &key name (thread (bordeaux-threads:current-thread)))
    Create a timer just as with TRIVIAL-TIMERS:MAKE-TIMER but schedule and reschedule FUNCTION according to SCHEDULER that is a function of no parameters that returns a universal time or NIL. The returned timer can be shut down with TRIVIAL-TIMERS:UNSCHEDULE-TIMER.
  • Class CRON-SCHEDULE
    A cron-like schedule. See MAKE-CRON-SCHEDULE for details.
    BUMPERS   Reader: BUMPERS
    The bumpers in decoded time component order.
  • Function MAKE-CRON-SCHEDULE (&key second minute hour day-of-month month year day-of-week)
    Construct a cron-like scheduler from the SECOND, MINUTE, etc bumpers for components of decoded times (using the default time zone for the time being). A bumper in its most generic from a function of three arguments: the current value, the whole decoded time, and the index of the current value in the decoded time. A bumper is expected to return the smallest value that is valid for that component and not less than the current value or NIL if it cannot find a valid value. Returning a value that is smaller than the current one is the same as returning NIL. A bumper can simply be a number which is equivalent to (CONSTANTLY NUMBER). Bumpers are not allowed to depend on `lower' components of the decoded time. The allowed dependency graph is this: SECOND -> MINUTE -> HOUR -> (DAY-OF-MONTH <-> DAY-OF-WEEK) -> MONTH -> YEAR That is, the SECOND bumper may look at the whole decoded time but the MINUTE bumper may not look at seconds. DAY-OF-WEEK and DAY-OF-MONTH may depend on each other to allow specifying the 'last Friday of the month'. The resolution of the schedule is defined implicitly by the lowest bumper. NEXT-TIME always bumps the component of the decoded time that belongs to the lowest bumper before trying to find mathces if its LAST-TIME argument is not NIL. Of course, DAY-OF-WEEK is the odd one out: it is the day-of-month component that is bumped if DAY-OF-WEEK is the lowest bumper. This scheme allows (MAKE-CRON-SCHEDULE :MONTH 12) trigger only once per year instead of every second in December. For a more packed schedule one can use the symbol '* as a bumper: (MAKE-CRON-SCHEDULE :HOUR '* :MONTH 12) which makes hour the lowest bumper and the schedule triggers every hour in December. It is an error if all bumpers are NIL.
  • Method NEXT-TIME ((schedule cron-schedule) &key (now (get-universal-time)) allow-now-p (limit *default-next-time-limit*))
  • Function FIND-DECODED-TIME-COMPONENT-BY-TYPE (type value decoded-time n)
    Return the first valid value not less than VALUE that is of TYPE.
  • Function MAKE-TYPED-CRON-BUMPER (type)
    Return a bumper function suitable for MAKE-CRON-SCHEDULE that returns the first valid value according to TYPE. Convenience function on top of FIND-DECODED-TIME-COMPONENT-BY-TYPE.
  • Function MAKE-TYPED-CRON-SCHEDULE (&key second minute hour day-of-month month year day-of-week)
    A convenience function much like MAKE-CRON-SCHEDULE but assumes that no bumper can be a function designator so it must be a number, the symbol * or a type specifier in which case it calls MAKE-TYPED-CRON-BUMPER on it providing a terser syntax.