summary refs log tree commit diff homepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xserver.c6
-rw-r--r--torus.h4
2 files changed, 7 insertions, 3 deletions
diff --git a/server.c b/server.c
index 7b16f33..e96d3dd 100755
--- a/server.c
+++ b/server.c
@@ -18,6 +18,7 @@ exec cc -Wall -Wextra -pedantic $@ -o server $0
 #include <sys/time.h>
 #include <sys/un.h>
 #include <sysexits.h>
+#include <time.h>
 #include <unistd.h>
 
 #include "torus.h"
@@ -37,11 +38,12 @@ static void tilesMap(void) {
 
 static struct Tile *tileGet(uint32_t tileX, uint32_t tileY) {
     struct Tile *tile = &tiles[tileY * TILE_ROWS + tileX];
-    if (!tile->present) {
+    if (!tile->create) {
         memset(tile->cells, ' ', CELLS_SIZE);
         memset(tile->colors, COLOR_WHITE, CELLS_SIZE);
-        tile->present = true;
+        tile->create = time(NULL);
     }
+    tile->access = time(NULL);
     return tile;
 }
 
diff --git a/torus.h b/torus.h
index bb012f2..968c9f6 100644
--- a/torus.h
+++ b/torus.h
@@ -2,6 +2,7 @@
 #include <stdbool.h>
 #include <stddef.h>
 #include <stdint.h>
+#include <time.h>
 
 #define ALIGNED(x) __attribute__((aligned(x)))
 
@@ -25,7 +26,8 @@ enum {
 #define CELL_INIT_Y (CELL_ROWS / 2)
 
 struct Tile {
-    bool present;
+    time_t create;
+    time_t access;
     char cells[CELL_ROWS][CELL_COLS] ALIGNED(16);
     uint8_t colors[CELL_ROWS][CELL_COLS] ALIGNED(16);
 } ALIGNED(4096);
1?id=1f8b9eda315347cd32363f5bbb9bd18e5ace3a85&follow=1'>Set bot mode on downgradeJune McEnroe 2021-09-15Enter capsicum in downgradeJune McEnroe 2021-09-15Factor out common parts of downgrade messagesJune McEnroe 2021-09-14Add downgrade IRC botJune McEnroe 2021-09-14Sort by title if authors matchJune McEnroe 2021-09-13Swap-remove tags as they're foundJune McEnroe 2021-09-12Replace htagml regex with strncmpJune McEnroe 2021-09-11Also defer printing comment for lone close-parensJune McEnroe 2021-09-10Publish "git-comment"June McEnroe 2021-09-10Add git comment --pretty optionJune McEnroe 2021-09-08Defer printing comment if line is blank or closing braceJune McEnroe 2021-09-08Up default min-repeat to 30 linesJune McEnroe 2021-09-08Handle dirty lines in git-commentJune McEnroe 2021-09-08Document and install git-commentJune McEnroe 2021-09-08Add repeat and all options to git-commentJune McEnroe 2021-09-08Add group threshold to git-commentJune McEnroe