Make Display format of Duration conform better to ISO 8601 - #1328
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1328 +/- ##
==========================================
- Coverage 93.41% 91.51% -1.91%
==========================================
Files 34 38 +4
Lines 16754 17316 +562
==========================================
+ Hits 15651 15846 +195
- Misses 1103 1470 +367 ☔ View full report in Codecov by Sentry. |
djc
reviewed
Sep 29, 2023
| // Count the number of significant digits, while removing all trailing zero's. | ||
| let mut figures = 9usize; | ||
| let mut fraction_digits = abs.nanos; | ||
| loop { |
Collaborator
Author
There was a problem hiding this comment.
To count the number of significant digits, and removing all trailing zero's. I.e. repeatedly divide nanos by 10.
I do not know a cleaner way to write it.
djc
approved these changes
Feb 10, 2024
pitdicker
force-pushed
the
duration_display
branch
from
February 10, 2024 18:34
fab1030 to
0454b09
Compare
jqnatividad
added a commit
to dathere/qsv
that referenced
this pull request
Feb 11, 2024
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.
The
Displayformat ofDurationcurrently converts all values greater than 24 hours to a value with days. But in ISO 8601P1Dhas a different meaning fromPT86400S.If we get a duration type that properly supports the ISO 8601 format with different components (#1282), I think we should fix the simple
Durationtype to always write only seconds. We later may be able to share the parser and aFromStrimplementation.I ported the code to count the significant fractional digits in
nanosfrom #1290.It should find a shared place once one of these PRs has landed.