mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Fix clock is always a second off
This commit is contained in:
parent
6ffc7ee3b3
commit
5e43b4f587
@ -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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user