about summary refs log tree commit diff
path: root/events.c
diff options
context:
space:
mode:
Diffstat (limited to 'events.c')
-rw-r--r--events.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/events.c b/events.c
index 35e2c5b..e9a4f83 100644
--- a/events.c
+++ b/events.c
@@ -16,6 +16,7 @@
 
 #include <err.h>
 #include <inttypes.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sysexits.h>
@@ -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;
 	}