Fix clock is always a second off

pull/333/head
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
1 changed files with 2 additions and 1 deletions

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);