fix(battery): animation framerate

This commit is contained in:
Jérôme BOULMIER
2019-03-09 00:14:39 -05:00
committed by Patrick Ziegler
parent d3844c40b6
commit e6e010e45b
4 changed files with 39 additions and 34 deletions

View File

@ -174,13 +174,16 @@ namespace modules {
void network_module::subthread_routine() {
const chrono::milliseconds framerate{m_animation_packetloss->framerate()};
const auto dur = chrono::duration<double>(framerate);
while (running()) {
auto now = chrono::system_clock::now();
if (m_connected && m_packetloss) {
m_animation_packetloss->increment();
broadcast();
}
sleep(dur);
now += framerate;
this_thread::sleep_until(now);
}
m_log.trace("%s: Reached end of network subthread", name());