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:
may 2024-09-05 04:35:29 +02:00 committed by GitHub
parent 8371920c6b
commit f4424b4204
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
}