From 98d22582eb7305973925f3e014bde3549320fee0 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:56:05 -0300 Subject: Messages: a clock's text is one function, Message.clockText(seconds, gmtoff), which the message stamp (with localtime_r's offset) and the tape's guessed clock both call where each wrote its own, and PARDES_NOTIME is read in one place, Message.noTime, which lsp_client's hideTime asks Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/tape.zig | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src/tape.zig') diff --git a/src/tape.zig b/src/tape.zig index 78b3c34b..29b1197d 100644 --- a/src/tape.zig +++ b/src/tape.zig @@ -949,14 +949,7 @@ pub const Guess = struct { real_ns: i64, mono_ns: i64, gmtoff: i32 }; fn guessed(comptime R: type, g: Guess) R { if (R == u32) return std.math.cast(u32, @divFloor(g.real_ns, std.time.ns_per_s)) orelse 0; if (R == i64) return @divFloor(g.mono_ns, std.time.ns_per_ms); - if (R == [8]u8) { - var clock: [8]u8 = "--:--:--".*; - const notime = if (libc.getenv("PARDES_NOTIME")) |v| std.mem.span(v).len != 0 else false; - if (notime) return clock; - const day = @mod(@divFloor(g.real_ns, std.time.ns_per_s) + g.gmtoff, 86400); - _ = std.fmt.bufPrint(&clock, "{d:0>2}:{d:0>2}:{d:0>2}", .{ @as(u32, @intCast(@divFloor(day, 3600))), @as(u32, @intCast(@mod(@divFloor(day, 60), 60))), @as(u32, @intCast(@mod(day, 60))) }) catch {}; - return clock; - } + if (R == [8]u8) return pardes.Messages.Message.clockText(@divFloor(g.real_ns, std.time.ns_per_s), g.gmtoff); @compileError("tape: no guess of a clock read as " ++ @typeName(R)); } -- cgit v1.3