Clock. Narrow seconds precision

Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
This commit is contained in:
Viktar Lukashonak 2023-07-25 00:08:05 +03:00
parent 6dfa74bd5d
commit dae7794bdf
No known key found for this signature in database
GPG Key ID: 08A413AA87200A6F

View File

@ -164,7 +164,9 @@ const date::time_zone* waybar::modules::Clock::current_timezone() {
auto waybar::modules::Clock::update() -> void { auto waybar::modules::Clock::update() -> void {
const auto* tz{current_timezone()}; const auto* tz{current_timezone()};
const date::zoned_time now{ 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{ const date::year_month_day today{
date::floor<date::days>(now.get_local_time())}; // Convert now to year_month_day date::floor<date::days>(now.get_local_time())}; // Convert now to year_month_day
const date::year_month_day shiftedDay{today + cldCurrShift_}; // Shift today const date::year_month_day shiftedDay{today + cldCurrShift_}; // Shift today