Repository navigation
date: pad numeric time zones like GNU when given a width or flag - #17141
Open
zodrickjohn wants to merge 1 commit into
Open
zodrickjohn wants to merge 1 commit into
zodrickjohn wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With a field width, or with the
+,^or#flags, the numeric time zone conversions (%z,%:z,%::z,%:::z) were formatted differently from GNU:TZ=Asia/Kolkata%3z+530+0530+530%+6z+00530+0530+00530%2:z+5:30+05:30+5:30%_:::z+5:30+5:30+5:30%3zwithTZ=UTC0+00+0000+00GNU first strips the zero padding of the hour, then pads the offset to the width (the width of the unmodified offset when none is given): with zeros after the sign, or with spaces before it under
_;-disables the padding. Only-and_used to strip the hour, only0padded with zeros, and a width alone went through the generic path.apply_timezone_modifiersnow handles every flag and width this way, andtimezone_default_widthis no longer needed.I compared GNU coreutils 9.12 and this branch on 3696 combinations (7 zones including +13:45 and -3:30, flags none/
0/_/-/+/^/#and pairs of them, widths 1 to 12) and they all match; on main 604 of the first 1400 differed. The new test fails on main.Separate, not changed here: for an offset with seconds (e.g.
TZ=Africa/Monrovia date -d @-1000000000), plain%zand%:zprint the seconds (-004430), where GNU prints-0044.