get rid of macro, use inline func
This commit is contained in:
10
src/sys.cpp
10
src/sys.cpp
@@ -55,8 +55,8 @@ void sys::getNetwork(Network* net, const std::string& device) {
|
||||
_net current;
|
||||
|
||||
current.ts = std::chrono::steady_clock::now();
|
||||
fastReadNum("/sys/class/net/" + device + "/statistics/rx_bytes", current.rx);
|
||||
fastReadNum("/sys/class/net/" + device + "/statistics/tx_bytes", current.tx);
|
||||
current.rx = fastReadNum("/sys/class/net/" + device + "/statistics/rx_bytes", buf);
|
||||
current.tx = fastReadNum("/sys/class/net/" + device + "/statistics/tx_bytes", buf);
|
||||
float ts_diff = std::chrono::duration_cast<std::chrono::microseconds>(current.ts - prev.ts).count() / 1000000.0f;
|
||||
net->download = (current.rx - prev.rx) / ts_diff;
|
||||
net->upload = (current.tx - prev.tx) / ts_diff;
|
||||
@@ -77,7 +77,7 @@ void sys::updateSensors(sysSensors* s) {
|
||||
if (s->hwmon.length() < 1)
|
||||
return;
|
||||
static char buf[8];
|
||||
fastReadNum(s->hwmon + "/fan2_input", s->fan_speed[0]);
|
||||
fastReadNum(s->hwmon + "/fan7_input", s->fan_speed[1]);
|
||||
fastReadNum(s->hwmon + "/temp5_input", s->t_sensor) / 1000;
|
||||
s->fan_speed[0] = fastReadNum(s->hwmon + "/fan2_input", buf);
|
||||
s->fan_speed[1] = fastReadNum(s->hwmon + "/fan7_input", buf);
|
||||
s->t_sensor = fastReadNum(s->hwmon + "/temp5_input", buf) / 1000;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user