repos / zmx

session persistence for terminal processes
git clone https://github.com/neurosnap/zmx.git

commit
8cf33e1
parent
58eb669
author
Eric Bower
date
2026-02-20 20:25:29 -0500 EST
chore: nanoTimestamp -> timestamp
1 files changed,  +10, -7
M src/main.zig
+10, -7
 1@@ -422,7 +422,7 @@ pub fn main() !void {
 2             .pid = undefined,
 3             .command = command,
 4             .cwd = cwd,
 5-            .created_at = @intCast(std.time.nanoTimestamp()),
 6+            .created_at = @intCast(std.time.timestamp()),
 7         };
 8         daemon.socket_path = try getSocketPath(alloc, cfg.socket_dir, sesh);
 9         std.log.info("socket path={s}", .{daemon.socket_path});
10@@ -464,7 +464,7 @@ pub fn main() !void {
11             .pid = undefined,
12             .command = null,
13             .cwd = cwd,
14-            .created_at = @intCast(std.time.nanoTimestamp()),
15+            .created_at = @intCast(std.time.timestamp()),
16             .is_task_mode = true,
17             .task_command = cmd_args_raw.items,
18         };
19@@ -1337,7 +1337,7 @@ fn daemonLoop(daemon: *Daemon, server_sock_fd: i32, pty_fd: i32) !void {
20                     if (daemon.is_task_mode and daemon.task_exit_code == null) {
21                         if (findTaskExitMarker(buf[0..n])) |exit_code| {
22                             daemon.task_exit_code = exit_code;
23-                            daemon.task_ended_at = @intCast(std.time.nanoTimestamp());
24+                            daemon.task_ended_at = @intCast(std.time.timestamp());
25 
26                             std.log.info("task completed exit_code={d}", .{exit_code});
27                             // Shell continues running - no break here
28@@ -1666,10 +1666,13 @@ fn writeSessionLine(writer: *std.Io.Writer, session: SessionEntry, short: bool,
29         session.created_at,
30     });
31     if (session.task_ended_at) |ended_at| {
32-        try writer.print("\ttask_ended_at={d}", .{ended_at});
33-    }
34-    if (session.task_exit_code) |exit_code| {
35-        try writer.print("\ttask_exit_code={d}", .{exit_code});
36+        if (ended_at > 0) {
37+            try writer.print("\ttask_ended_at={d}", .{ended_at});
38+
39+            if (session.task_exit_code) |exit_code| {
40+                try writer.print("\ttask_exit_code={d}", .{exit_code});
41+            }
42+        }
43     }
44     if (session.cwd) |cwd| {
45         try writer.print("\tstarted_in={s}", .{cwd});