-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix strflocaltime on daylight saving time values #2202
base: master
Are you sure you want to change the base?
Conversation
@wtlangford - I cannot say whether this PR fixes all TZ-related bugs in jq, but I hope that you will keep in mind that the serious TZ-related bugs in jq are "silent" and as such really deserve to be prioritized, even over a release of jq 1.7. If you're too busy to attend to these "silent" TZ-related bugs yourself, perhaps we could recruit some volunteers to review this particular PR, but if we do so, would you be able at least to try to "pull" the PR if the reviewers attest to its being an improvement? Thanks. |
Issue: #1912. |
d25af32
to
50e9b3a
Compare
The following behaviour demonstrates how the daylight savings value gets lost when a time value gets turned into an internal array of numbers and then back into a (struct tm): $ TZ=Europe/London ./jq -r -n '1504803635 | strflocaltime("%Y-%m-%d %H:%M:%S (%Z)")' 2017-09-07 18:00:35 (GMT) After this change however, this works as expected: $ TZ=Europe/London ./jq -r -n '1504803635 | strflocaltime("%Y-%m-%d %H:%M:%S (%Z)")' 2017-09-07 18:00:35 (BST)
50e9b3a
to
439cf72
Compare
Branch 439cf72 works for me, thx. |
@nicowilliams was this fixed by the recent locale-related patches? |
No, sadly. |
I installed 1.7 yesterday and it seemed to have fixed one of my scripts that uses it? /shrug |
This PR changes the way time values get serialised and deserialised to the internal format when passing them between stages. Previously the internal value didn't retain the dst value so time values would lose that field and when printed using
strflocaltime
, the fact the value was in DST was lost. This seems to me to be the only way to havestrflocaltime
printing the correct time zone information on values during a daylight saving time.The following behaviour demonstrates how the daylight savings value gets
lost when a time value gets turned into an internal array of numbers and
then back into a (struct tm):
After this change however, this works as expected:
(the only difference is in the
%Z
value - "BST" instead of the incorrect "GMT").