mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-12 21:18:13 +08:00
prs_time
This commit is contained in:
@@ -18,7 +18,7 @@ bool AddTask(pTimedTask task)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (task->time <= task_top->time)
|
||||
if (task->prs_time <= task_top->prs_time)
|
||||
{
|
||||
task->next = task_top;
|
||||
task_top = task;
|
||||
@@ -28,7 +28,7 @@ bool AddTask(pTimedTask task)
|
||||
pTimedTask tmp = task_top;
|
||||
while (tmp)
|
||||
{
|
||||
if ((task->time > tmp->time && task->time <= tmp->next->time)
|
||||
if ((task->prs_time > tmp->prs_time && task->prs_time <= tmp->next->prs_time)
|
||||
|| tmp->next == NULL)
|
||||
{
|
||||
task->next = tmp->next;
|
||||
@@ -61,7 +61,7 @@ bool DelTask(int time)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (time == task_top->time)
|
||||
if (time == task_top->prs_time)
|
||||
{
|
||||
pTimedTask tmp = task_top;
|
||||
task_top = task_top->next;
|
||||
@@ -78,7 +78,7 @@ bool DelTask(int time)
|
||||
pTimedTask tmp_tsk = task_top->next;
|
||||
while (tmp_tsk)
|
||||
{
|
||||
if (time == tmp_tsk->time)
|
||||
if (time == tmp_tsk->prs_time)
|
||||
{
|
||||
pre_tsk->next = tmp_tsk->next;
|
||||
free(tmp_tsk);
|
||||
@@ -101,7 +101,7 @@ char* GetTaskStr()
|
||||
{
|
||||
char buffer[26];
|
||||
struct tm* tm_info;
|
||||
tm_info = localtime(&tmp_tsk->time);
|
||||
tm_info = localtime(&tmp_tsk->prs_time);
|
||||
strftime(buffer, 26, "%Y-%m-%d %H:%M:%S", tm_info);
|
||||
|
||||
sprintf(tmp_str, "{time:'%s',socket_index:%d,on:%d},",
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#pragma once
|
||||
#include <time.h>
|
||||
|
||||
struct TimedTask;
|
||||
typedef struct TimedTask* pTimedTask;
|
||||
struct TimedTask
|
||||
{
|
||||
int time; //被执行的格林尼治时间戳
|
||||
time_t prs_time; //被执行的格林尼治时间戳
|
||||
int socket_idx; //要控制的插孔
|
||||
int on; //开或者关
|
||||
pTimedTask next; //下一个任务(按之间排序)
|
||||
|
||||
Reference in New Issue
Block a user