Merge branch 'Alexays:master' into master

This commit is contained in:
Arnesh Roychowdhury 2024-01-17 18:29:14 +05:30 committed by GitHub
commit 3de6d2e859
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -28,7 +28,7 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
if (!zone_name.isString()) continue;
if (zone_name.asString().empty())
// local time should be shown
tzList_.push_back(current_zone());
tzList_.push_back(nullptr);
else
try {
tzList_.push_back(locate_zone(zone_name.asString()));
@ -39,7 +39,7 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
} else if (config_["timezone"].isString()) {
if (config_["timezone"].asString().empty())
// local time should be shown
tzList_.push_back(current_zone());
tzList_.push_back(nullptr);
else
try {
tzList_.push_back(locate_zone(config_["timezone"].asString()));
@ -47,7 +47,7 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
spdlog::warn("Timezone: {0}. {1}", config_["timezone"].asString(), e.what());
}
}
if (!tzList_.size()) tzList_.push_back(current_zone());
if (!tzList_.size()) tzList_.push_back(nullptr);
// Calendar properties
if (cldInTooltip_) {
@ -127,7 +127,7 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
}
auto waybar::modules::Clock::update() -> void {
auto tz{tzList_[tzCurrIdx_]};
auto tz{tzList_[tzCurrIdx_] ?: current_zone()};
const zoned_time now{tz, floor<seconds>(system_clock::now())};
label_.set_markup(fmt_lib::vformat(locale_, format_, fmt_lib::make_format_args(now)));