summaryrefslogtreecommitdiff
path: root/src/tape.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:56:05 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:02:08 -0300
commit98d22582eb7305973925f3e014bde3549320fee0 (patch)
tree31e532bd4d6c4b59ef7811cf03150e722d20ea31 /src/tape.zig
parent53c8d3d4c3c9673c0070eceb652326193fb32012 (diff)
downloadpardes-98d22582eb7305973925f3e014bde3549320fee0.tar.gz
pardes-98d22582eb7305973925f3e014bde3549320fee0.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/tape.zig')
-rw-r--r--src/tape.zig9
1 files changed, 1 insertions, 8 deletions
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));
}