We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b0bc2d1 commit 2c61784Copy full SHA for 2c61784
3 files changed
src/cli/Middleware.zig
@@ -112,7 +112,11 @@ pub fn loggingMiddleware(ctx: *MiddlewareContext) !bool {
112
113
/// Timing middleware
114
pub fn timingMiddleware(ctx: *MiddlewareContext) !bool {
115
- const start = std.time.milliTimestamp();
+ const start = blk: {
116
+ var ts: std.c.timespec = .{ .sec = 0, .nsec = 0 };
117
+ _ = std.c.clock_gettime(std.c.CLOCK.REALTIME, &ts);
118
+ break :blk @as(i64, ts.sec) * 1000 + @as(i64, @intCast(@divTrunc(ts.nsec, std.time.ns_per_ms)));
119
+ };
120
try ctx.set("start_time", try std.fmt.allocPrint(ctx.allocator, "{d}", .{start}));
121
return true;
122
}
src/prompt/PathPrompt.zig
@@ -62,7 +62,10 @@ pub fn prompt(self: *PathPrompt) ![]const u8 {
62
continue;
63
64
65
- std.time.sleep(10 * std.time.ns_per_ms);
+ {
66
+ var ts: std.c.timespec = .{ .sec = 0, .nsec = 10 * std.time.ns_per_ms };
67
+ _ = std.c.nanosleep(&ts, null);
68
+ }
69
70
71
try self.core.finish();
src/prompt/Table.zig
@@ -11,10 +11,10 @@ pub const Alignment = enum {
11
};
12
13
pub const TableStyle = enum {
14
- simple, // Simple ASCII
15
- rounded, // Rounded corners
16
- double, // Double lines
17
- minimal, // Minimal borders
+ simple, // Simple ASCII
+ rounded, // Rounded corners
+ double, // Double lines
+ minimal, // Minimal borders
18
19
20
pub const Column = struct {
@@ -47,7 +47,7 @@ pub fn deinit(self: *Table) void {
47
for (self.rows.items) |row| {
48
self.allocator.free(row);
49
50
- self.rows.deinit();
+ self.rows.deinit(self.allocator);
51
52
53
pub fn withStyle(self: Table, style: TableStyle) Table {
@@ -62,7 +62,7 @@ pub fn addRow(self: *Table, row: []const []const u8) !void {
const row_copy = try self.allocator.dupe([]const u8, row);
- try self.rows.append(row_copy);
+ try self.rows.append(self.allocator, row_copy);
pub fn render(self: *Table) !void {
0 commit comments