diff --git a/TC1/timed_task/timed_task.c b/TC1/timed_task/timed_task.c index 4094c68..d1697ca 100644 --- a/TC1/timed_task/timed_task.c +++ b/TC1/timed_task/timed_task.c @@ -28,8 +28,9 @@ bool AddTask(pTimedTask task) pTimedTask tmp = task_top; while (tmp) { - if ((task->prs_time > tmp->prs_time && task->prs_time <= tmp->next->prs_time) - || tmp->next == NULL) + if (tmp->next == NULL + || (task->prs_time >= tmp->prs_time + && task->prs_time < tmp->next->prs_time)) { task->next = tmp->next; tmp->next = task;