We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bdd87a6 commit 32939eaCopy full SHA for 32939ea
src/detection/uptime/uptime_bsd.c
@@ -6,7 +6,11 @@
6
7
const char* ffDetectUptime(FFUptimeResult* result)
8
{
9
+ #if __NetBSD__
10
+ struct timespec bootTime;
11
+ #else
12
struct timeval bootTime;
13
+ #endif
14
size_t bootTimeSize = sizeof(bootTime);
15
if(sysctl(
16
(int[]) {CTL_KERN, KERN_BOOTTIME}, 2,
@@ -15,7 +19,11 @@ const char* ffDetectUptime(FFUptimeResult* result)
19
) != 0)
20
return "sysctl({CTL_KERN, KERN_BOOTTIME}) failed";
17
21
22
23
+ result->bootTime = (uint64_t) bootTime.tv_sec * 1000 + (uint64_t) bootTime.tv_nsec / 10000000;
24
18
25
result->bootTime = (uint64_t) bootTime.tv_sec * 1000 + (uint64_t) bootTime.tv_usec / 1000;
26
27
result->uptime = ffTimeGetNow() - result->bootTime;
28
29
return NULL;
0 commit comments