Repository navigation
fix: keep sub-second precision and long durations of protobuf times - #864
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
07b531c to
d4494a7
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07b531c7d9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| $nanos = (int) \round($seconds * self::NANOSECONDS_PER_SECOND_FLOAT); | ||
|
|
||
| return (new Duration()) | ||
| ->setSeconds(\intdiv($nanos, self::NANOSECONDS_PER_SECOND)) |
There was a problem hiding this comment.
Split whole seconds before converting the fraction to nanoseconds
For float durations above roughly 9.22 billion seconds on 64-bit PHP, multiplying the entire duration by one billion exceeds PHP_INT_MAX; casting the result then corrupts the seconds as well as the fractional part. For example, 10000000000.5 now produces seconds = -8446744073, turning a positive duration into a negative one. Both duration marshallers now use this helper, so this introduces whole-second corruption for long durations that previously retained their seconds. Extract the whole seconds first and scale only the fractional remainder, accounting for rounding that carries into the next second.
Useful? React with 👍 / 👎.
Convert Timestamp/Duration with protobuf helpers and DateInterval::parse. Keep sub-second times in schedule backfill and matching times. Share float seconds to Duration conversion in DateInterval::secondsToDuration. Marshal schedule enums as values with EnumValueType.
d4494a7 to
9e2e4e9
Compare
What was changed
Protobuf
Timestamp/Durationconversions keep sub-second precision and long durations (schedule backfill, matching times,describe()→update()). Schedule enums marshal as values.Why?
Sub-second parts were truncated, and durations of one month or longer came back as months, which changed them on
update().Checklist
Closes: follow-up to fix(client): keep leading zeros when converting protobuf timestamps #862
How was this tested: new unit tests; Unit, Acceptance and schedule acceptance suites pass.
Any docs updates needed? No.