-
Notifications
You must be signed in to change notification settings - Fork 3
fix: debug event timezone handling #79
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
Conversation
* feat: implement AllFlags
| if (!event.require_full_event) { | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bugfix: debug event emit logic shouldn't be gated by require_full_event (which right now is equivalent to the flag's track_events prop.)
| std::istringstream string_stream(datetime); | ||
| string_stream.imbue(std::locale("en_US.utf-8")); | ||
| string_stream >> std::get_time(&gmt_tm, "%a, %d %b %Y %H:%M:%S GMT"); | ||
| if (string_stream.fail()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bugfix: simply parsing using std::get_time followed by mktime gives us a std::chrono::system_clock::time_point in local time. We need to actually compute the offset and subtract it out.
This code is just so painful. C++20 has a parse method which might help, or we can import a 3rd party library..
Fixes the handling of timezones when parsing the
Dateheader from HTTP responses.The problem was that the date given by servers is GMT, but code was interpreting that in the local host's timezone, leading to an 8 hour offset for me. Instead, we need to obtain the offset and subtract that out of the parsed result.