Skip to content

fix(client): keep leading zeros when converting protobuf timestamps - #862

Merged
xepozz merged 1 commit into
temporalio:masterfrom
pcbeingused333:fix/timestamp-microseconds
Nov 29, 2026
Merged

xepozz merged 1 commit into
temporalio:masterfrom
pcbeingused333:fix/timestamp-microseconds

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

ProtoToArrayConverter converts a protobuf Timestamp with sprintf('%d.%d', $seconds, $nanos / 1000) and parses the result with the U.u format. The microseconds are not zero-padded, so any value below 100000 µs is read as a larger fraction: 5 ms (nanos = 5000000) becomes .5000, which is parsed as 500 ms.

The converter is used by ScheduleClient and ScheduleHandle, so the timestamps in schedule listings and descriptions can be off by up to about a second.

The fix pads the fraction to six digits (%06d).

Validation

Added testTimestampKeepsLeadingZerosOfMicroseconds to ProtoToArrayConverterTestCase. Without the change it fails (1700000000.500000 instead of 1700000000.005000) and with it the test passes.

This change was prepared with AI assistance.

@pcbeingused333
pcbeingused333 requested review from a team, roxblnfk and wolfy-j as code owners November 28, 2026 22:26
@xepozz
xepozz merged commit b3cae66 into temporalio:master Nov 29, 2026
91 of 92 checks passed
@xepozz

xepozz commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

xepozz added a commit that referenced this pull request Nov 29, 2026
BackfillRequest comes from the marshalled BackfillPeriod, matching times use Timestamp::fromDateTime().
The psalm baseline follows the ProtoToArrayConverter change from #862.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants