mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-12 13:08:13 +08:00
定时任务是今天
This commit is contained in:
@@ -48,7 +48,8 @@ bool AddTaskWeek(pTimedTask task)
|
||||
time_t now = time(NULL);
|
||||
int today_weekday = (now / day_sec + 3) % 7 + 1; //1970-01-01 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int next_day = task->weekday - today_weekday;
|
||||
next_day = next_day > 0 ? next_day : next_day + 7;
|
||||
bool next_day_is_today = next_day == 0 && task->prs_time % day_sec > now % day_sec;
|
||||
next_day = next_day > 0 || next_day_is_today ? next_day : next_day + 7;
|
||||
task->prs_time = (now - now % day_sec) + (next_day * day_sec) + task->prs_time % day_sec;
|
||||
|
||||
return AddTaskSingle(task);
|
||||
|
||||
Reference in New Issue
Block a user