mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
Uptime (Linux): fix linux bootTime (#1249)
the previous implementation was adding the elapsed time since boot to the current time instead of subtracting it
This commit is contained in:
parent
8371920c6b
commit
f4424b4204
@ -20,7 +20,7 @@ const char* ffDetectUptime(FFUptimeResult* result)
|
||||
if(err != buf)
|
||||
{
|
||||
result->uptime = (uint64_t) (sec * 1000);
|
||||
result->bootTime = ffTimeGetNow() + result->uptime;
|
||||
result->bootTime = ffTimeGetNow() - result->uptime;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@ -32,7 +32,7 @@ const char* ffDetectUptime(FFUptimeResult* result)
|
||||
return "clock_gettime(CLOCK_BOOTTIME) failed";
|
||||
|
||||
result->uptime = (uint64_t) uptime.tv_sec * 1000 + (uint64_t) uptime.tv_nsec / 1000000;
|
||||
result->bootTime = ffTimeGetNow() + result->uptime;
|
||||
result->bootTime = ffTimeGetNow() - result->uptime;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user