Uptime (Windows): use QueryUnbiasedInterruptTime

As suggested by MSDN
This commit is contained in:
李通洲
2025-04-15 16:41:19 +08:00
parent 6da8181bbe
commit b812f3ccde
+4 -2
View File
@@ -1,11 +1,13 @@
#include "uptime.h"
#include "common/time.h"
#include <sysinfoapi.h>
#include <realtimeapiset.h>
const char* ffDetectUptime(FFUptimeResult* result)
{
result->uptime = GetTickCount64();
// According to MSDN, this function only fails if it's called with NULL
QueryUnbiasedInterruptTime(&result->uptime);
result->uptime /= 10000; // Convert from 100-nanosecond intervals to milliseconds
result->bootTime = ffTimeGetNow() - result->uptime;
return NULL;
}