Skip to content

Commit b812f3c

Browse files
committed
Uptime (Windows): use QueryUnbiasedInterruptTime
As suggested by MSDN
1 parent 6da8181 commit b812f3c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#include "uptime.h"
22
#include "common/time.h"
33

4-
#include <sysinfoapi.h>
4+
#include <realtimeapiset.h>
55

66
const char* ffDetectUptime(FFUptimeResult* result)
77
{
8-
result->uptime = GetTickCount64();
8+
// According to MSDN, this function only fails if it's called with NULL
9+
QueryUnbiasedInterruptTime(&result->uptime);
10+
result->uptime /= 10000; // Convert from 100-nanosecond intervals to milliseconds
911
result->bootTime = ffTimeGetNow() - result->uptime;
1012
return NULL;
1113
}

0 commit comments

Comments
 (0)