about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/inc/meta.baseof.htm2
-rw-r--r--src/main.zig11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/inc/meta.baseof.htm b/src/inc/meta.baseof.htm
index 6b47717..0345a58 100644
--- a/src/inc/meta.baseof.htm
+++ b/src/inc/meta.baseof.htm
@@ -24,7 +24,7 @@
 			<section id="backrefs"><!-- no backrefs --></section>
 		</main>
 		<footer>
-			Edited on 2026-04-08 <a href="https://git.sr.ht/~robertgzr/site/tree/master/src/inc/{[builtin.path]}" target="_blank">[src]</a>
+			Edited on {[builtin.mtime]} <a href="https://git.sr.ht/~robertgzr/site/tree/master/src/inc/{[builtin.path]}" target="_blank">[src]</a>
 			<a href="mailto:~robertgzr/public-inbox@lists.sr.ht">[comments]</a>
 			<br>
 			<b>robertgzr</b>
diff --git a/src/main.zig b/src/main.zig
index 8432917..27aa316 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -1,3 +1,7 @@
+const C = @cImport({
+    @cInclude("time.h");
+});
+
 const std = @import("std");
 const Io = std.Io;
 const Allocator = std.mem.Allocator;
@@ -541,6 +545,13 @@ const Builder = struct {
             try w.writeAll(self.source.path);
             return;
         }
+        if (std.mem.eql(u8, ref_name, "builtin.mtime")) {
+            var buf: [BUFFER_SIZE]u8 = undefined;
+            const tm: isize = @intCast(self.source.mtime.toSeconds());
+            const n = C.strftime(&buf, buf.len, "%F", C.localtime(&tm));
+            try w.writeAll(buf[0..n]);
+            return;
+        }
         // TODO: other builtins?
 
         switch (ref_name[0]) {