summary refs log tree commit diff homepage
path: root/server.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2017-07-30 14:15:15 -0400
committerJune McEnroe <june@causal.agency>2017-07-30 14:15:15 -0400
commitf48c10f46eab1c11827516a0610f7cd71d74bdad (patch)
tree5642eaee3da22677b315c89faaf2f60e76478b42 /server.c
parentAssert stable struct Tile field offsets (diff)
downloadtorus-f48c10f46eab1c11827516a0610f7cd71d74bdad.tar.gz
torus-f48c10f46eab1c11827516a0610f7cd71d74bdad.zip
Add tile create and access timestamps
Diffstat (limited to '')
-rwxr-xr-xserver.c6
1 files changed, 4 insertions, 2 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;
 }