summaryrefslogtreecommitdiffstats
path: root/admin/Sources/Services/ogAdmServer/sources/schedule.c
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2020-05-06 18:46:29 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-06-02 12:32:36 +0200
commit6b5800739000ff786018d6e8d89aca95406486f1 (patch)
tree297c1ef1b8127eff7bdabb223b5513c53a573fb5 /admin/Sources/Services/ogAdmServer/sources/schedule.c
parent4ddd66071883ebb175d5310c3ff206319073ecad (diff)
#942 add enum og_schedule_type
Diffstat (limited to 'admin/Sources/Services/ogAdmServer/sources/schedule.c')
-rw-r--r--admin/Sources/Services/ogAdmServer/sources/schedule.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/admin/Sources/Services/ogAdmServer/sources/schedule.c b/admin/Sources/Services/ogAdmServer/sources/schedule.c
index 3d30aadc..d7eb3363 100644
--- a/admin/Sources/Services/ogAdmServer/sources/schedule.c
+++ b/admin/Sources/Services/ogAdmServer/sources/schedule.c
@@ -197,7 +197,8 @@ static void og_schedule_remove_duplicates()
static void og_schedule_create_weekdays(int month, int year,
int *hours, int minutes, int week_days,
- uint32_t task_id, uint32_t schedule_id)
+ uint32_t task_id, uint32_t schedule_id,
+ enum og_schedule_type type)
{
struct og_schedule *schedule;
int month_days[5];
@@ -235,6 +236,7 @@ static void og_schedule_create_weekdays(int month, int year,
schedule->seconds = mktime(&tm);
schedule->task_id = task_id;
schedule->schedule_id = schedule_id;
+ schedule->type = type;
og_schedule_add(schedule);
}
}
@@ -243,7 +245,8 @@ static void og_schedule_create_weekdays(int month, int year,
static void og_schedule_create_weeks(int month, int year,
int *hours, int minutes, int weeks,
- uint32_t task_id, uint32_t schedule_id)
+ uint32_t task_id, uint32_t schedule_id,
+ enum og_schedule_type type)
{
struct og_schedule *schedule;
int month_days[7];
@@ -284,6 +287,7 @@ static void og_schedule_create_weeks(int month, int year,
schedule->seconds = mktime(&tm);
schedule->task_id = task_id;
schedule->schedule_id = schedule_id;
+ schedule->type = type;
og_schedule_add(schedule);
}
}
@@ -292,7 +296,8 @@ static void og_schedule_create_weeks(int month, int year,
static void og_schedule_create_days(int month, int year,
int *hours, int minutes, int *days,
- uint32_t task_id, uint32_t schedule_id)
+ uint32_t task_id, uint32_t schedule_id,
+ enum og_schedule_type type)
{
struct og_schedule *schedule;
struct tm tm;
@@ -315,12 +320,14 @@ static void og_schedule_create_days(int month, int year,
schedule->seconds = mktime(&tm);
schedule->task_id = task_id;
schedule->schedule_id = schedule_id;
+ schedule->type = type;
og_schedule_add(schedule);
}
}
}
void og_schedule_create(unsigned int schedule_id, unsigned int task_id,
+ enum og_schedule_type type,
struct og_schedule_time *time)
{
int year, month, minutes;
@@ -346,21 +353,24 @@ void og_schedule_create(unsigned int schedule_id, unsigned int task_id,
hours, minutes,
time->week_days,
task_id,
- schedule_id);
+ schedule_id,
+ type);
if (time->weeks)
og_schedule_create_weeks(month, year,
hours, minutes,
time->weeks,
task_id,
- schedule_id);
+ schedule_id,
+ type);
if (time->days)
og_schedule_create_days(month, year,
hours, minutes,
days,
task_id,
- schedule_id);
+ schedule_id,
+ type);
}
}
@@ -389,7 +399,7 @@ void og_schedule_update(struct ev_loop *loop, unsigned int schedule_id,
unsigned int task_id, struct og_schedule_time *time)
{
og_schedule_delete(loop, schedule_id);
- og_schedule_create(schedule_id, task_id, time);
+ og_schedule_create(schedule_id, task_id, OG_SCHEDULE_TASK, time);
}
static void og_agent_timer_cb(struct ev_loop *loop, ev_timer *timer, int events)