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

Format chrono: implemented glibc extension for padding seconds, minutes and hours #3572

Closed
LukashonakV opened this issue Aug 5, 2023 · 2 comments
Labels

Comments

@LukashonakV
Copy link

Dear @ShawnZhong ,
Thank you for your great PR #2959, #3271 .
For simple sys_time time points it works well.
Is it possible to extend this functionality on the whole chrono.. for example for all time zone API which is included into C++20 standard. ?
The issue here: waybar uses date::zoned_time class which is std::chrono::zoned_time (See zoned_time) .. and for this TZ API padding seconds, minutes, hours doesn't work :(

Here an example of waybar code: clock.cpp:166 . Then when we try to get formatted output at clock.cpp:178 we got wrong printed result. In the same time all other common format masks work well with zoned_time.

@vitaut
Copy link
Contributor

vitaut commented Aug 5, 2023

This can be done with a custom formatter but a PR to support zoned time would be welcome if the extension makes sense there.

@vitaut vitaut closed this as completed Aug 5, 2023
@vitaut vitaut added the question label Aug 5, 2023
@bradrn
Copy link

bradrn commented Aug 12, 2023

a PR to support zoned time would be welcome if the extension makes sense there.

I see no reason why it shouldn’t make sense there — if the time can be printed with a leading 0, it can surely be printed with a leading space too! If I get time I might look into making a PR, but until then perhaps this issue should be re-opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants