diff options
| author | Robert Günzler <r@gnzler.io> | 2026-09-23 23:46:34 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2026-10-02 10:39:47 +0200 |
| commit | 3a6b743935593d21ca8abd286f881f2a9b153a66 (patch) | |
| tree | ffb0ad311ae70913bf458d6775c8f00984fbb38a | |
| parent | b076ad7f7889a4290091231f9803affdc227553b (diff) | |
| download | site-3a6b743935593d21ca8abd286f881f2a9b153a66.tar.gz | |
write mtime
Signed-off-by: Robert Günzler <r@gnzler.io>
| -rw-r--r-- | src/inc/meta.baseof.htm | 2 | ||||
| -rw-r--r-- | src/main.zig | 11 |
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]) { |