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

daily file sink - daylight saving time #827

Open
MarioPoneder opened this issue Sep 11, 2018 · 2 comments
Open

daily file sink - daylight saving time #827

MarioPoneder opened this issue Sep 11, 2018 · 2 comments
Labels

Comments

@MarioPoneder
Copy link

Hello,

it seems like there is a problem with daylight saving time, because the method spdlog::sinks::daily_file_sink::next_rotation_tp_() just adds 24 hours on return.

Kind regards
Mario

@gabime gabime added the wontfix label Sep 16, 2018
@gabime
Copy link
Owner

gabime commented Sep 16, 2018

I can't find a reliable and fast way to handle dst. mktime might fail detecting it, and it is not well defined what to do anyway if the rotation time is same as dst.

@gabime gabime closed this as completed Sep 16, 2018
@gabime gabime reopened this Sep 16, 2018
@USAFrenzy
Copy link

USAFrenzy commented Apr 15, 2022

I don't know if this has already been addressed in other issues, but with the addition of C++20's date time functionalities, std::chrono::time_zone's get_info() function returns a variable save which gives the daylight savings offset which could be helpful here. That being said, I'm not sure if this is worth looking into and providing a feature flag check to include or not based on C++20 requirements for this specific case, but the upside might be the fact that you would only have to pay the cost once initially and maybe whenever there was a check before rotating the log file.

The only other thing I can think of is bundling a form of Howard's date library with date/tz.h similar to how spdlog currently bundles a subsection of fmtlib, and optimizing some wrappers around the base calls that the C++20 additions call for the get_info().save variable, but I understand if adding dependencies is something that isn't wanted here.

It might take some time to do, especially as I'm still learning my way around programming as a whole, but I would be happy to try to put something together for this if either case sounds like a plausible solution? If not, I totally understand.

bachittle pushed a commit to bachittle/spdlog that referenced this issue Dec 22, 2022
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