Method code for $scheduler.add_task()

[Turn off line numbering]
  1: arg time, method, @args;
  2: var task, i, j, tid, flags, x, y, task_time;
  3: 
  4: if (type(time) != 'integer || type(method) != 'symbol || type(args) != 'list)
  5:     throw(~type, "Arguments are not an integer, symbol, and list.");
  6: if (time < 0)
  7:     throw(~time, "Time is negative.");
  8: if (time > 31536000)
  9:     throw(~time, "Try to schedule a task LESS than a year from now?");
 10: 
 11: // get a new db task id
 12: ++task_index;
 13: tid = task_index;
 14: 
 15: // flags can be set in a system only add_task, for now set them as 'system
 16: flags = ['system];
 17: task_time = time();
 18: task = [tid, time + task_time, task_time, sender(), caller(), method, flags, args];
 19: .add_to_task_queue(task);
 20: return tid;

// Miroslav Silovic
// Created 05-Sep-1995 as a part of ColdCore, see: @help Credit

Tlon