mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Uptime (Windows): use QueryUnbiasedInterruptTime
As suggested by MSDN
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user