diff --git a/src/ALabel.cpp b/src/ALabel.cpp index f7a98329..5db03457 100644 --- a/src/ALabel.cpp +++ b/src/ALabel.cpp @@ -25,8 +25,14 @@ ALabel::ALabel(const Json::Value& config, const std::string& name, const std::st ? std::chrono::milliseconds::max() : std::chrono::milliseconds( (config_["interval"].isNumeric() - ? std::max(1L, // Minimum 1ms due to millisecond precision - static_cast(config_["interval"].asDouble() * 1000)) + ? (config_["interval"].asDouble() > 0 + // Minimum 1ms due to millisecond precision + ? std::max(1L, static_cast( + config_["interval"].asDouble() * 1000)) + // An explicit interval of 0 means "no periodic refresh" + // (event-driven only). Flooring it to 1ms busy-loops the + // main thread; keep it as the 0 sentinel (see custom.cpp). + : 0L) : 1000 * (long)interval))), default_format_(format_) { label_.set_name(name);