debug: log all planned events after finishing each

This commit is contained in:
Libor Peltan 2024-06-18 16:49:14 +02:00 committed by Daniel Salzman
parent 8c4416b88b
commit 74c646ef36

View file

@ -256,6 +256,14 @@ static void event_wrap(worker_task_t *task)
pthread_cond_broadcast(events->run_end);
}
char dbg_log[512] = { 0 }, *dbg_log_end = &dbg_log[0];
time_t now = time(NULL);
for (int i = 0; i < ZONE_EVENT_COUNT; i++) {
time_t t = events->time[i];
dbg_log_end += snprintf(dbg_log_end, sizeof(dbg_log) - (dbg_log_end - dbg_log), "%s %c%ld; ", zone_events_get_name(i), t ? '+' : ' ', t ? t - now : 0);
}
log_zone_info(zone->name, "events: %s", dbg_log);
reschedule(events, true); // unlocks events->mx
}