Skip to content

Commit

Permalink
Uptime (Linux): fix linux bootTime (#1249)
Browse files Browse the repository at this point in the history
the previous implementation was adding the elapsed time since
boot to the current time instead of subtracting it
  • Loading branch information
m4rch3n1ng committed Sep 5, 2024
1 parent 8371920 commit f4424b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/detection/uptime/uptime_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -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;
}

0 comments on commit f4424b4

Please sign in to comment.