feat: support strptime_ns mixed epoch formats and nanosecond bounds#2550
Open
yyuuttaaoo wants to merge 2 commits intoalibaba:mainfrom
Open
feat: support strptime_ns mixed epoch formats and nanosecond bounds#2550yyuuttaaoo wants to merge 2 commits intoalibaba:mainfrom
yyuuttaaoo wants to merge 2 commits intoalibaba:mainfrom
Conversation
Keep legacy %s behavior while allowing %s%f and %s.%f parsing, and cap fractional parsing at 9 digits to avoid overflow and precision surprises. Change-Id: Idec80452f7512714462502a8a29e76b0eb59745b Co-developed-by: Cursor <noreply@cursor.com> Made-with: Cursor
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support in strptime_ns for parsing epoch seconds with optional fractional nanoseconds across mixed formats, while constraining fractional precision to nanosecond bounds.
Changes:
- Extend
%shandling to accept%s%fand%s.%fformats while keeping legacy%sbehavior. - Add
%s(seconds-since-epoch) support into the general format parser. - Cap fractional parsing to at most 9 digits in
conv_nanosecond.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| core/unittest/common/TimeUtilUnittest.h | Adds unit tests for new %s%f / %s.%f support and updated legacy %s expectations. |
| core/common/Strptime.cpp | Implements mixed epoch+fraction parsing and enforces a 9-digit fractional limit; adds %s handling in the main format switch. |
…dling of fractional seconds. Removed unnecessary checks for dot and fraction presence in the format string, simplifying the logic for nanosecond conversion. Updated unit tests to cover additional cases for nanosecond precision. Change-Id: Iabc1234567890abcdef1234567890abcdef12345678 Co-developed-by: Cursor <noreply@cursor.com>
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.
Keep legacy %s behavior while allowing %s%f and %s.%f parsing, and cap fractional parsing at 9 digits to avoid overflow and precision surprises.
Change-Id: Idec80452f7512714462502a8a29e76b0eb59745b
Co-developed-by: Cursor noreply@cursor.com
Made-with: Cursor