Closed kfiros closed 3 years ago
Just checked. There's a clear correlation between the first value in /proc/uptime
and std::chrono::steady_clock
.
Used the following snippet to validate it:
#include <chrono>
#include <iostream>
int main()
{
auto boot = std::chrono::time_point<std::chrono::steady_clock>{};
auto now = std::chrono::steady_clock::now();
std::cout << std::chrono::duration_cast<std::chrono::seconds>(now - boot).count() << std::endl;
return 0;
}
When I run: cat /proc/uptime; ./a.out
I get:
>>> cat /proc/uptime; ./a.out
651668.56 650711.66
651668
So we can definitely change the values in the struct to hold steady_clock::duration
. Wanna do that @kfiros?
Yes, assign me please.
We should consider changing the uptime struct to hold std::chrono::steady_clock::duration instead of doubles.