modified: src/db.c

modified:   src/db.h
	modified:   src/iCal.c
	modified:   src/llist.c
	modified:   src/planner.c
	modified:   src/planner.h
	modified:   src/test.c
This commit is contained in:
simon committed 2024-12-11 13:03:28 +01:00
1 parent 8e233caf99
commit f559d2a8bf
7 files changed
+40 -19

No files matched your search

+15
View File
@@ -8,6 +8,7 @@
#include "planner.h" // for subject and event structs
// #include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -21,6 +22,13 @@ Event *newEvent(Task *t, time_t s, time_t e, uint64_t sp) {
}
return r;
}
// pretty print Event
const char eventFormat[] =
"Event { %s = {\n start={%lu},\n end={%lu},\n spare={%lu}\n}\n";
void printEvent(Event *s) {
printf(eventFormat, s->task->name, s->plannedStartTime, s->plannedEndTime,
s->spare);
}
Task *newTask(char *n, time_t c, time_t d, int p, uint64_t sp) {
Task *r = (Task *)malloc(sizeof(Task));
@@ -35,6 +43,13 @@ Task *newTask(char *n, time_t c, time_t d, int p, uint64_t sp) {
return r;
}
// pretty print task
const char taskFormat[] = "Task { %s = {\n created={%lu},\n deadline={%lu},\n "
"priority={%d},\n spare={%lu}\n}\n";
void printTask(Task *s) {
printf(taskFormat, s->name, s->created, s->deadline, s->priority, s->spare);
}
// for llist
int cmpTask(void *a, void *b) {
Task *aa = (Task *)a;