From 1e82982dbdf89834d24859f781b587ec03019017 Mon Sep 17 00:00:00 2001 From: Guillaume Maudoux Date: Fri, 4 Oct 2019 23:25:09 +0200 Subject: [PATCH] Detect timezone changes Fixes #479, because upstream does not intend to. It may be less expensive to do that only once in a while, or to inotify-watch on /etc/timezone, but this is good enough. --- src/modules/clock.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/clock.cpp b/src/modules/clock.cpp index 83a15c1a..2fa02142 100644 --- a/src/modules/clock.cpp +++ b/src/modules/clock.cpp @@ -1,4 +1,5 @@ #include "modules/clock.hpp" +#include waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config) : ALabel(config, "clock", id, "{:%H:%M}", 60) { @@ -12,6 +13,7 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config) } auto waybar::modules::Clock::update() -> void { + tzset(); // Update timezone information auto now = std::chrono::system_clock::now(); auto localtime = fmt::localtime(std::chrono::system_clock::to_time_t(now)); auto text = fmt::format(format_, localtime);