From 65f5f3574237791a0da6563c2983dbbcd261f7f9 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 12 Jul 2020 12:24:22 -0400 Subject: Add events gaps --- events.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/events.c b/events.c index 35e2c5b..e9a4f83 100644 --- a/events.c +++ b/events.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -158,6 +159,8 @@ enum kcgi_err eventsPage(struct kreq *req) { int rows; int result; + time_t prevTime = 0; + int64_t prevEvent = 0; for (rows = 0; SQLITE_ROW == (result = sqlite3_step(events)); ++rows) { int i = 0; struct Event event = {0}; @@ -195,6 +198,17 @@ enum kcgi_err eventsPage(struct kreq *req) { if (error) return error; } + if (prevTime && event.time - prevTime >= eventsGap) { + error = 0 + || khtml_attr(&html, KELEM_TR, KATTR_CLASS, "gap", KATTR__MAX) + || khtml_attr(&html, KELEM_TH, KATTR_COLSPAN, "3", KATTR__MAX) + || khtml_puts(&html, "...") + || khtml_closeelem(&html, 2); + if (error) return error; + } + prevEvent = event.event; + prevTime = event.time; + error = htmlEvent(&html, scope, event); if (error) return error; } -- cgit 1.4.1