Merge pull request #2345 from LukashonakV/ISSUE_2344

Clock. Narrow seconds precision
This commit is contained in:
Alexis Rouillard 2023-07-24 23:19:19 +02:00 committed by GitHub
commit 9207fff627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -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