chore(macos): rename a variable
This commit is contained in:
@@ -59,18 +59,18 @@ pub fn getSystemUptime() !SystemUptime {
|
|||||||
var boot_time: c_libproc.struct_timeval = undefined;
|
var boot_time: c_libproc.struct_timeval = undefined;
|
||||||
var size: usize = @sizeOf(c_libproc.struct_timeval);
|
var size: usize = @sizeOf(c_libproc.struct_timeval);
|
||||||
|
|
||||||
var uptime: f64 = 0.0;
|
var uptime_seconds: 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, name.len, &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 = now_seconds - boot_seconds;
|
uptime_seconds = now_seconds - boot_seconds;
|
||||||
} else {
|
} else {
|
||||||
return error.UnableToGetSystemUptime;
|
return error.UnableToGetSystemUptime;
|
||||||
}
|
}
|
||||||
|
|
||||||
var remainig_seconds: f64 = uptime;
|
var remainig_seconds: f64 = uptime_seconds;
|
||||||
const days: f64 = @floor(remainig_seconds / seconds_per_day);
|
const days: f64 = @floor(remainig_seconds / seconds_per_day);
|
||||||
|
|
||||||
remainig_seconds = (remainig_seconds / seconds_per_day) - days;
|
remainig_seconds = (remainig_seconds / seconds_per_day) - days;
|
||||||
|
|||||||
Reference in New Issue
Block a user