datetime: add compact timedelta formatting for zero-day durations#1185
Open
14NGiestas wants to merge 1 commit intofortran-lang:masterfrom
Open
datetime: add compact timedelta formatting for zero-day durations#118514NGiestas wants to merge 1 commit intofortran-lang:masterfrom
14NGiestas wants to merge 1 commit intofortran-lang:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1185 +/- ##
==========================================
+ Coverage 68.81% 68.88% +0.07%
==========================================
Files 408 408
Lines 13726 13786 +60
Branches 1552 1568 +16
==========================================
+ Hits 9446 9497 +51
- Misses 4280 4289 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a700b84 to
244ffba
Compare
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.
Summary
This PR improves duration formatting in the datetime module by adding compact, human-friendly output for zero-day timedeltas while preserving the existing verbose format for nonzero-day values.
What changed
format_timedeltainsrc/datetime/stdlib_datetime.f90to use compact zero-day formatting:5msfor sub-second durations1.500sor42sfor sub-minute durationsMM:SSwhen hours are zeroHH:MM:SS[.mmm]otherwiseX days, HH:MM:SS[.mmm].doc/specs/stdlib_datetime.md.example/datetime/example_datetime_usage.f90.test/datetime/test_datetime.f90.Why
The prior formatting was always verbose, which made short durations harder to scan. Compact formatting improves readability for common short intervals while preserving the legacy representation where day-level context is meaningful.
Validation
test_datetimeincludes new compact-format coverage and legacy-format checks.Compatibility