-
Notifications
You must be signed in to change notification settings - Fork 64
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
Align the nsecs field of the timestamps. #45
Align the nsecs field of the timestamps. #45
Conversation
@@ -121,7 +121,7 @@ def strify_message(val, indent='', time_offset=None, current_time=None, field_fi | |||
nsec_str = '\n%snsecs: ' % indent + (format_str % val.nsecs) | |||
return sec_str + nsec_str | |||
else: | |||
return '\n%ssecs: %s\n%snsecs: %s'%(indent, val.secs, indent, val.nsecs) | |||
return '\n%ssecs: %s\n%snsecs:% 10d'%(indent, val.secs, indent, val.nsecs) |
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.
Would this make more sense: nsecs: %9d
I completely agree, your suggestion more clearly explains the intent of the formatting. |
The change looks good to me now. Thanks for the PR and updating it. Please squash the changes into a single commit before the merge. |
This change ensures that the nsecs field is always right aligned such that the least significant digit of the nsecs field aligns with the least significant digit of the secs field. This makes it easier to inspect how far into the second the time has progressed. The format specification explains the intent; always one space and aligned to the right with a minimum width of 9 characters.
838ea5b
to
edb9c5a
Compare
This should be it. |
Great. Thanks. |
Align the nsecs field of the timestamps.
Due to our change the regression test fails (at this test: test_genpy_message.py#L568), would you like me to add a commit that introduces the spaces to fix this? |
I noticed the failing test after merging. If you could create a new PR which fixes the problem that works be great. Thanks. |
The alignment of the nsecs field was changed in ros/genpy@edb9c5a and merged with pull request ros#45, this caused the regression test for the timestamp field to fail. This commit updates the comparison value of the regression tests to reflect the new alignment.
The alignment of the nsecs field was changed in ros/genpy@edb9c5a (pull request ros#45), this caused the regression test for the timestamp field to fail. This commit updates the comparison value of the regression tests to reflect the new alignment.
The alignment of the nsecs field was changed in ros/genpy@edb9c5a (pull request ros#45), this caused the regression test for the timestamp field to fail. This commit updates the comparison value of the regression tests to reflect the new alignment.
This change ensures that the nsecs field is always right aligned such that the least significant digit of the secs field aligns with the least significant digit of the secs field. This makes it easier to inspect how far into the second the time has progressed.
Before:
After:
A minor aesthetic change, but this makes it easier to look for the start of a certain second, as well as easier to read because the values of the same significance are always on the same position.
Hopefully it doesn't break anyone's scripts relying on the output; there still is always a space after the semicolon, but below the 100ms there are multiple spaces between the semicolon and the number.