111
This commit is contained in:
@@ -79,31 +79,31 @@ class Timer {
|
||||
local func = Info[0];
|
||||
//参数
|
||||
local func_args = Info[1];
|
||||
//下次任务叠加时间
|
||||
//Cron字符串
|
||||
local NextTimestep = Info[2];
|
||||
//执行函数
|
||||
func.acall(func_args);
|
||||
//继续构建下一次任务
|
||||
Date_Exec_Tree.insert(time() + NextTimestep, Info);
|
||||
Date_Exec_Tree.insert(Sq_Cron_Next(NextTimestep, time()), Info);
|
||||
}
|
||||
|
||||
function SetCronTask(target_func, CronString, ...) {
|
||||
local parts = split(CronString, "/");
|
||||
local minute = parts[0].tointeger();
|
||||
local hour = parts[1].tointeger();
|
||||
local day = parts[2].tointeger();
|
||||
local weekday = parts[3].tointeger();
|
||||
// local parts = split(CronString, "/");
|
||||
// local minute = parts[0].tointeger();
|
||||
// local hour = parts[1].tointeger();
|
||||
// local day = parts[2].tointeger();
|
||||
// local weekday = parts[3].tointeger();
|
||||
|
||||
local S_minute = minute * 60;
|
||||
local S_hour = hour * 60 * 60;
|
||||
local S_day = day * 24 * 60 * 60;
|
||||
local S_weekday = weekday * 7 * 24 * 60 * 60;
|
||||
// local S_minute = minute * 60;
|
||||
// local S_hour = hour * 60 * 60;
|
||||
// local S_day = day * 24 * 60 * 60;
|
||||
// local S_weekday = weekday * 7 * 24 * 60 * 60;
|
||||
|
||||
local AddTimestep = S_minute + S_hour + S_day + S_weekday;
|
||||
// local AddTimestep = S_minute + S_hour + S_day + S_weekday;
|
||||
local NowTimestep = time();
|
||||
|
||||
//下一次执行的时间
|
||||
local NextTimestep = AddTimestep + NowTimestep;
|
||||
local NextTimestep = Sq_Cron_Next(CronString, NowTimestep);
|
||||
|
||||
local target_arg_list = [];
|
||||
target_arg_list.push(getroottable());
|
||||
@@ -119,7 +119,7 @@ class Timer {
|
||||
//参数列表
|
||||
func_info.push(target_arg_list);
|
||||
//间隔时间戳时间
|
||||
func_info.push(AddTimestep);
|
||||
func_info.push(CronString);
|
||||
|
||||
_Timer_Object.Date_Exec_Tree.insert(NextTimestep, func_info);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user