summaryrefslogtreecommitdiff
path: root/src/tape.zig
diff options
context:
space:
mode:
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));
}