Giacomo Pati <[EMAIL PROTECTED]> writes: <snip/>
> First, if you look at the Cornerstone Scheduler you'll see > that the ability to define repeated tasks are somehow > limited. Business apps can easily request administration > tasks to be run twice a day on work days. To define this with > the Cornerstone Scheduler you'll need to add 10 'cron' > entries to it. This is why I'd like to extend it using the > unix cron direction to define ranges and list of timing > aspects. But then you're faced with the problem of defining > sleep time for efficient use (which you need to be able to > cooperate in the Cornerstone Scheduler machinery). > > The unix cron daemon runs every minute to check if there are > any jobs to run. It checks initially creating bitsets for the > minute, hour, day, month, and weekday definition for each > task. This makes it easy to check whether a task has to be > launched. I still haven't found an algorithm (and I think > there isn't an easy one available) to determine the sleep > time until the next task is due. I did this once upon a time, I think in C code. As I recall it's basically the equivalent of building a Map of tasks and the calculated delta time until they need to be executed next and then using the minimum of these deltas. I don't think it's all that complex? This could be a little problematic if the delta's are in the same order of magnitude as the time to calculate them :-), but that certainly doesn't seem to be the case here.... <snip/>
