Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clock. Narrow seconds precision #2345

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/modules/clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ const date::time_zone* waybar::modules::Clock::current_timezone() {
auto waybar::modules::Clock::update() -> void {
const auto* tz{current_timezone()};
const date::zoned_time now{
tz, std::chrono::system_clock::now()}; // Define local time is based on provided time zone
tz,
date::floor<std::chrono::seconds>(
std::chrono::system_clock::now())}; // Define local time is based on provided time zone
const date::year_month_day today{
date::floor<date::days>(now.get_local_time())}; // Convert now to year_month_day
const date::year_month_day shiftedDay{today + cldCurrShift_}; // Shift today
Expand Down