-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Customizable timestamps #343
Merged
Conversation
This file contains 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
jonas-schievink
force-pushed
the
timestamp
branch
from
January 15, 2021 12:30
12ce882
to
25b2c65
Compare
jonas-schievink
force-pushed
the
timestamp
branch
from
January 15, 2021 12:49
25b2c65
to
39706f9
Compare
jonas-schievink
force-pushed
the
timestamp
branch
from
January 15, 2021 12:54
39706f9
to
c0a71da
Compare
regarding the book update, whst's left to do there? would it make sense to open an issue about that so it's transparent and we don't forget? |
I think that's all done now |
japaric
approved these changes
Jan 15, 2021
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.
This is awesome!
bors r=japaric |
Build succeeded: |
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.
Closes #106
Based on #342, since that was needed to fix the test in here.
This changes the
defmt::timestamp
proc macro to work just like the logging macros, but in item scope. This allows full customization of the timestamp, as well as "real" omission if no timestamp is used (currently we just always have a timestamp of 0).Summary of changes
#[defmt::timestamp]
is now a regular proc macro instead of an attribute.timestamp
tag was added to identify the format string used indefmt::timestamp!
.timestamp
tag and omit it accordingly.µs
display hint was added to retain the previous time formatting. It interprets an integer as a time in microseconds and formats it likeX.XXXXXX
. We could potentially be more fancy here and allow arbitrary scaling of fixed-point decimal and binary values, but that seemed fairly complex, so I did this instead.Limitations
{=u64:µs}
. However that is no longer LEB-encoded, so it takes up more space if it's a small number (eg. a monotonic counter). We could fix this by encoding integers with LEB128, or by adding a newleb128
format type.I probably still need to update the book and other docs.Done!