mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
ISSUE #878. Try catch Clock timezones
This commit is contained in:
parent
f29a400c97
commit
43862ceb34
@ -22,14 +22,20 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
|
|||||||
is_timezoned_list_in_tooltip_(false) {
|
is_timezoned_list_in_tooltip_(false) {
|
||||||
if (config_["timezones"].isArray() && !config_["timezones"].empty()) {
|
if (config_["timezones"].isArray() && !config_["timezones"].empty()) {
|
||||||
for (const auto& zone_name : config_["timezones"]) {
|
for (const auto& zone_name : config_["timezones"]) {
|
||||||
if (!zone_name.isString() || zone_name.asString().empty()) {
|
if (!zone_name.isString() || zone_name.asString().empty())
|
||||||
time_zones_.push_back(nullptr);
|
|
||||||
continue;
|
continue;
|
||||||
|
try {
|
||||||
|
time_zones_.push_back(date::locate_zone(zone_name.asString()));
|
||||||
|
} catch(const std::exception& e) {
|
||||||
|
spdlog::warn("Timezone: {0}. {1}", zone_name.asString(), e.what());
|
||||||
}
|
}
|
||||||
time_zones_.push_back(date::locate_zone(zone_name.asString()));
|
|
||||||
}
|
}
|
||||||
} else if (config_["timezone"].isString() && !config_["timezone"].asString().empty()) {
|
} else if (config_["timezone"].isString() && !config_["timezone"].asString().empty()) {
|
||||||
time_zones_.push_back(date::locate_zone(config_["timezone"].asString()));
|
try {
|
||||||
|
time_zones_.push_back(date::locate_zone(config_["timezone"].asString()));
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
spdlog::warn("Timezone: {0}. {1}", config_["timezone"].asString(), e.what());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If all timezones are parsed and no one is good, add current time zone. nullptr in timezones
|
// If all timezones are parsed and no one is good, add current time zone. nullptr in timezones
|
||||||
|
Loading…
Reference in New Issue
Block a user