mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Uptime (NetBSD): fix invalid result
This commit is contained in:
@@ -6,7 +6,11 @@
|
||||
|
||||
const char* ffDetectUptime(FFUptimeResult* result)
|
||||
{
|
||||
#if __NetBSD__
|
||||
struct timespec bootTime;
|
||||
#else
|
||||
struct timeval bootTime;
|
||||
#endif
|
||||
size_t bootTimeSize = sizeof(bootTime);
|
||||
if(sysctl(
|
||||
(int[]) {CTL_KERN, KERN_BOOTTIME}, 2,
|
||||
@@ -15,7 +19,11 @@ const char* ffDetectUptime(FFUptimeResult* result)
|
||||
) != 0)
|
||||
return "sysctl({CTL_KERN, KERN_BOOTTIME}) failed";
|
||||
|
||||
#if __NetBSD__
|
||||
result->bootTime = (uint64_t) bootTime.tv_sec * 1000 + (uint64_t) bootTime.tv_nsec / 10000000;
|
||||
#else
|
||||
result->bootTime = (uint64_t) bootTime.tv_sec * 1000 + (uint64_t) bootTime.tv_usec / 1000;
|
||||
#endif
|
||||
result->uptime = ffTimeGetNow() - result->bootTime;
|
||||
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user