chore: remove a magic number

This commit is contained in:
utox39
2025-03-03 01:37:13 +01:00
parent aff0106ed2
commit 436d643f23

View File

@@ -55,7 +55,7 @@ pub fn getSystemUptime() !SystemUptime {
var uptime_ns: f64 = 0.0; var uptime_ns: f64 = 0.0;
var name = [_]c_int{ c_sysctl.CTL_KERN, c_sysctl.KERN_BOOTTIME }; var name = [_]c_int{ c_sysctl.CTL_KERN, c_sysctl.KERN_BOOTTIME };
if (c_sysctl.sysctl(&name, 2, &boot_time, &size, null, 0) == 0) { if (c_sysctl.sysctl(&name, name.len, &boot_time, &size, null, 0) == 0) {
const boot_seconds = @as(f64, @floatFromInt(boot_time.tv_sec)); 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.time.timestamp()));
uptime_ns = now_seconds - boot_seconds; uptime_ns = now_seconds - boot_seconds;