From 6c70dac17cf83c71c9a5dfcaecdb2c79df71b174 Mon Sep 17 00:00:00 2001 From: utox39 Date: Wed, 11 Feb 2026 18:51:10 +0100 Subject: [PATCH] refactor(macos-uptime): use new Io Timestamp --- src/macos/system.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/macos/system.zig b/src/macos/system.zig index 179d34b..cc4bc20 100644 --- a/src/macos/system.zig +++ b/src/macos/system.zig @@ -35,7 +35,7 @@ pub fn getLocale(allocator: std.mem.Allocator, environ: std.process.Environ) ![] /// Returns the system uptime. /// /// Uses `sysctl` to fetch the system boot time and calculates the elapsed time. -pub fn getSystemUptime() !SystemUptime { +pub fn getSystemUptime(io: std.Io) !SystemUptime { const seconds_per_day: f64 = 86400.0; const hours_per_day: f64 = 24.0; const seconds_per_hour: f64 = 3600.0; @@ -49,7 +49,7 @@ pub fn getSystemUptime() !SystemUptime { var name = [_]c_int{ c_sysctl.CTL_KERN, c_sysctl.KERN_BOOTTIME }; if (c_sysctl.sysctl(&name, name.len, &boot_time, &size, null, 0) == 0) { const boot_seconds = @as(f64, @floatFromInt(boot_time.tv_sec)); - const now_seconds = @as(f64, @floatFromInt(std.time.timestamp())); + const now_seconds = @as(f64, @floatFromInt(std.Io.Timestamp.now(io, .real).toSeconds())); uptime_seconds = now_seconds - boot_seconds; } else { return error.UnableToGetSystemUptime;