Unknown state [2025-08-04]

This commit is contained in:
2025-08-04 22:28:49 -04:00
parent 6e4b76a6d9
commit 3b252de1ca
27 changed files with 24509 additions and 0 deletions

29
statusline/Time.zig Normal file
View File

@@ -0,0 +1,29 @@
const std = @import("std");
const Self = @This();
const time = @cImport({
@cInclude("time.h");
});
buf: []u8,
pub fn init(self: *Self, alloc: std.mem.Allocator) !void {
self.buf = try alloc.alloc(u8, 64);
errdefer alloc.free(self.buf);
}
pub fn update(self: *Self) ![]const u8 {
const tt: time.time_t = time.time(null);
const tp = time.localtime(&tt);
const n = time.strftime(
self.buf.ptr,
self.buf.len,
"%c",
tp,
);
return self.buf[0..n];
}
pub fn deinit(self: *Self, alloc: std.mem.Allocator) void {
alloc.free(self.buf);
}