Repository navigation
Test 2 oss-20B - #2
Open
ahmetkaansever wants to merge 1 commit into
Open
ahmetkaansever wants to merge 1 commit into
ahmetkaansever wants to merge 1 commit into
Conversation
…ctional durations
WalkthroughThe PR adds sub‑second support to chrono formatting across the library. New helpers convert durations to non‑negative integers, compute absolute values, powers of ten, and count fractional digits. `tm_writer` now accepts optional sub‑seconds and prints them when a second changes. `chrono_formatter` handles any `duration` (including floating‑point), forwards sub‑seconds to the writer, and formats fractional seconds. The system‑clock and UTC formatters forward sub‑seconds, and `formatter` gains an overload that takes a sub‑second duration. All duplicate helper definitions are removed. Tests are updated to cover a wide range of duration types and verify correct sub‑second output. No further downstream changes are required.Changes| Files | Summary | |-------|---------| | `include/fmt/chrono.h` | Added sub‑second helpers, extended `tm_writer` and `chrono_formatter` to handle sub‑seconds, removed duplicates, updated public overloads. | | `test/chrono-test.cc`, `test/xchar-test.cc` | Updated tests to cast system clock to seconds, added sub‑second formatting tests for various duration types and precisions. |Sequence Diagram```mermaid sequenceDiagram participant User participant fmt as fmt::format participant chrono_fmt as chrono_formatter participant tm_writer as tm_writer participant sys_clock as system_clock formatter participant utc_clock as UTC clock formatter |
There was a problem hiding this comment.
Commits
Files that changed from the base of the PR and between Base and e21e942 commits: 3Files Selected For Review: 3
- include/fmt/chrono.h with diff length 15943.
- test/chrono-test.cc with diff length 4017.
- test/xchar-test.cc with diff length 421.
Review comments generated: (19)
- Review: 0
- LGTM: 19
- Identified issue already discussed: 0
Tips
Chat with Deeployed Bot (@@deeployed-peer-dev)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@@deeployed-peer-devin a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@deeployed-peer-dev: ignoreanywhere in the PR description to pause further reviews from the bot.
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.
General Description
Implemented sub‑second support for chrono formatting. Added helper utilities for non‑negative integer conversion, absolute duration handling, fractional digit counting, and sub‑second formatting. Updated
tm_writerto accept an optional sub‑second duration and print it when formatting seconds. Extendedchrono_formatterto handle floating‑point and non‑integer durations, and updated the system‑clock formatter to forward subseconds. Added comprehensive tests for various duration types and sub‑second formatting.File changes
include/fmt/chrono.hto_nonnegative_int,abs,pow10,count_fractional_digits,write_sub_sec,format_sec_fractional.tm_writerwith constructors that accept a sub‑second duration and logic to print sub‑seconds inon_second.chrono_formatterto use new helpers, support floating‑point seconds, and print sub‑seconds.tm_writer.std::tmwith subseconds.test/chrono-test.cctime_point_cast<std::chrono::seconds>for consistency.test/xchar-test.cc