CRON

CRON( time )

timeA string expression containing a unix-standard cron time.
Return:CRON defines a single timer event.

The CRON function defines a timer event for use within the WHEN workflow service or WAIT function. This is synonymous with EVENT('CRON', time).

The time parameter is unix-standard cron time, expressed in UTC (aka Greenwich Mean Time) as a string containing the following, space-delimited components:

minute hour dom month dow

minuteAn integer value for the minute of the hour. Valid values are from 0 to 59.
hourAn integer value for the hour. Valid values are from 0 to 23 (using the 24 hour clock).
domAn integer value for the day of the month. Valid values are from 1 to 31.
monthAn integer value for the month. Valid values are from 1 to 12.
dowAn integer value for the day of the week. Valid values are from 0 to 6 (where 0 represents Sunday).

Any time component that you do not want to pass is replaced by an asterisk (*). You may define ranges of times using a dash (-), lists using a comma (,), and 'once every n' using a slash (/). For example, 6-18/3 in the hour field will fire the timer every three hours between 6am and 6pm, and 18-21/3,0-6/3 will fire the timer every three hours between 6pm and 6am.

Example:

EXPORT events := MODULE
  EXPORT dailyAtMidnight := CRON('0 0 * * *');
  EXPORT dailyAt( INTEGER hour,
   INTEGER minute=0) :=
  EVENT('CRON',
   (STRING)minute + ' ' + (STRING)hour + ' * * *');
  EXPORT dailyAtMidday := dailyAt(12, 0);
  EXPORT EveryThreeHours :=  CRON('0 0-23/3 * * *');
END;

BUILD(teenagers) : WHEN(events.dailyAtMidnight);
BUILD(oldies)    : WHEN(events.dailyAt(6));
BUILD(NewStuff)    : WHEN(events.EveryThreeHours);

See Also: EVENT, WHEN, WAIT, NOTIFY