Fix clock is always a second off

This commit is contained in:
RX14 2019-05-19 13:30:19 +01:00
parent 6ffc7ee3b3
commit 5e43b4f587
No known key found for this signature in database
GPG Key ID: CEF2BBFE18BD0E67

View File

@ -23,7 +23,8 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
} }
auto waybar::modules::Clock::update() -> void { auto waybar::modules::Clock::update() -> void {
auto localtime = fmt::localtime(std::time(nullptr)); 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); auto text = fmt::format(format_, localtime);
label_.set_markup(text); label_.set_markup(text);