return SWITCH_STATUS_SUCCESS;
}
-#define SCHED_BROADCAST_SYNTAX "[+]<time> <uuid> <path> [aleg|bleg|both]"
+#define SCHED_BROADCAST_SYNTAX "[[+]<time>|@time] <uuid> <path> [aleg|bleg|both]"
SWITCH_STANDARD_API(sched_broadcast_function)
{
char *mycmd = NULL, *argv[4] = { 0 };
switch_media_flag_t flags = SMF_NONE;
time_t when;
- if (*argv[0] == '+') {
+ if (*argv[0] == '@') {
+ when = atol(argv[0] + 1);
+ } else if (*argv[0] == '+') {
when = switch_epoch_time_now(NULL) + atol(argv[0] + 1);
} else {
when = atol(argv[0]);
tp->func(&tp->task);
+ if (tp->task.repeat) {
+ tp->task.runtime = switch_epoch_time_now(NULL) + tp->task.repeat;
+ }
+
if (tp->task.runtime > tp->executed) {
tp->executed = 0;
if (switch_event_create(&event, SWITCH_EVENT_RE_SCHEDULE) == SWITCH_STATUS_SUCCESS) {
{
switch_scheduler_task_container_t *container, *tp;
switch_event_t *event;
+ switch_time_t now = switch_epoch_time_now(NULL);
switch_mutex_lock(globals.task_mutex);
switch_zmalloc(container, sizeof(*container));
switch_assert(func);
+
+ if (task_runtime < now) {
+ container->task.repeat = task_runtime;
+ task_runtime += now;
+ }
+
container->func = func;
container->task.created = switch_epoch_time_now(NULL);
container->task.runtime = task_runtime;