about summary refs log tree commit diff
path: root/src/gen.zig
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2025-10-03 17:38:27 +0200
committerRobert Günzler <r@gnzler.io>2025-10-03 18:40:50 +0200
commitea7deae11b488c4d4b6a15f8e6272bd7a5550866 (patch)
tree213eb72bbc6bede25ac67afe76827d96bbbef80f /src/gen.zig
parent109b73a3936c90aa89cd12c60aacf51439d31370 (diff)
downloadsite-ea7deae11b488c4d4b6a15f8e6272bd7a5550866.tar.gz
split formatting out of get_mtime
this allows changing how the time value should be formatted to prepare
for using this to make pandoc renders reproducable

Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to '')
-rw-r--r--src/gen.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gen.zig b/src/gen.zig
index dbfb1ba..6d2f124 100644
--- a/src/gen.zig
+++ b/src/gen.zig
@@ -110,7 +110,8 @@ fn genSite(ctx: *Context) !void {
 // build a single html file
 fn build(allocator: std.mem.Allocator, w: std.io.AnyWriter, page_name: []const u8, srcpath: []const u8) !void {
     const mtime = try fs.get_mtime(allocator, srcpath);
-    defer allocator.free(mtime);
+    const mtime_str = try fs.format_mtime(allocator, mtime, "%F");
+    defer allocator.free(mtime_str);
 
     // HEAD
     try w.print(
@@ -178,7 +179,7 @@ fn build(allocator: std.mem.Allocator, w: std.io.AnyWriter, page_name: []const u
         .LICENSE_NAME = Context.params.LICENSE_NAME,
         .LICENSE_URL = Context.params.LICENSE_URL,
         .LICENSE_YEAR = Context.params.LICENSE_YEAR,
-        .MTIME = mtime,
+        .MTIME = mtime_str,
         .PATH = srcpath,
         .PUBLIC_INBOX = Context.params.PUBLIC_INBOX,
         .SOURCE_URL = Context.params.SOURCE_URL,