Skip to content

feat: support strptime_ns mixed epoch formats and nanosecond bounds#2550

Open
yyuuttaaoo wants to merge 2 commits intoalibaba:mainfrom
yyuuttaaoo:timestamp_ns_native_parse
Open

feat: support strptime_ns mixed epoch formats and nanosecond bounds#2550
yyuuttaaoo wants to merge 2 commits intoalibaba:mainfrom
yyuuttaaoo:timestamp_ns_native_parse

Conversation

@yyuuttaaoo
Copy link
Copy Markdown
Collaborator

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

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
Copilot AI review requested due to automatic review settings April 15, 2026 08:02
@yyuuttaaoo yyuuttaaoo added the enhancement Feature enhancement label Apr 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 %s handling to accept %s%f and %s.%f formats while keeping legacy %s behavior.
  • 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.

Comment thread core/common/Strptime.cpp
Comment thread core/common/Strptime.cpp
Comment thread core/common/Strptime.cpp Outdated
…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>
@yyuuttaaoo yyuuttaaoo requested a review from linrunqi08 April 15, 2026 15:26
@yyuuttaaoo yyuuttaaoo changed the title support strptime_ns mixed epoch formats and nanosecond bounds feat: support strptime_ns mixed epoch formats and nanosecond bounds Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants