use steady clock instead of system clock
This commit is contained in:
parent
e6e010e45b
commit
982a22cd62
@ -160,8 +160,11 @@ namespace modules {
|
|||||||
*/
|
*/
|
||||||
void battery_module::start() {
|
void battery_module::start() {
|
||||||
this->inotify_module::start();
|
this->inotify_module::start();
|
||||||
|
// We only start animation thread if there is at least one animation.
|
||||||
|
if (m_animation_charging || m_animation_discharging) {
|
||||||
m_subthread = thread(&battery_module::subthread, this);
|
m_subthread = thread(&battery_module::subthread, this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release wake lock when stopping the module
|
* Release wake lock when stopping the module
|
||||||
@ -345,13 +348,13 @@ namespace modules {
|
|||||||
m_log.trace("%s: Start of subthread", name());
|
m_log.trace("%s: Start of subthread", name());
|
||||||
|
|
||||||
while (running()) {
|
while (running()) {
|
||||||
auto now = chrono::system_clock::now();
|
auto now = chrono::steady_clock::now();
|
||||||
auto framerate = 1000U; // milliseconds
|
auto framerate = 1000U; // milliseconds
|
||||||
if (m_state == battery_module::state::CHARGING) {
|
if (m_state == battery_module::state::CHARGING && m_animation_charging) {
|
||||||
m_animation_charging->increment();
|
m_animation_charging->increment();
|
||||||
broadcast();
|
broadcast();
|
||||||
framerate = m_animation_charging->framerate();
|
framerate = m_animation_charging->framerate();
|
||||||
} else if (m_state == battery_module::state::DISCHARGING) {
|
} else if (m_state == battery_module::state::DISCHARGING && m_animation_discharging) {
|
||||||
m_animation_discharging->increment();
|
m_animation_discharging->increment();
|
||||||
broadcast();
|
broadcast();
|
||||||
framerate = m_animation_discharging->framerate();
|
framerate = m_animation_discharging->framerate();
|
||||||
|
@ -176,7 +176,7 @@ namespace modules {
|
|||||||
const chrono::milliseconds framerate{m_animation_packetloss->framerate()};
|
const chrono::milliseconds framerate{m_animation_packetloss->framerate()};
|
||||||
|
|
||||||
while (running()) {
|
while (running()) {
|
||||||
auto now = chrono::system_clock::now();
|
auto now = chrono::steady_clock::now();
|
||||||
if (m_connected && m_packetloss) {
|
if (m_connected && m_packetloss) {
|
||||||
m_animation_packetloss->increment();
|
m_animation_packetloss->increment();
|
||||||
broadcast();
|
broadcast();
|
||||||
|
Loading…
Reference in New Issue
Block a user