Repository navigation
fix(time_slave): use free-running clock for gPTP timestamps - #285
Open
gordon9901 wants to merge 1 commit into
Open
gordon9901 wants to merge 1 commit into
gordon9901 wants to merge 1 commit into
Conversation
gordon9901
requested a deployment
to
workflow-approval
October 29, 2026 10:13 — with
GitHub Actions
Waiting
gordon9901
requested a deployment
to
workflow-approval
October 29, 2026 10:13 — with
GitHub Actions
Waiting
Contributor
License Check Results🚀 The license check job ran with the Bazel command: bazel run //:license-checkStatus: Click to expand output |
Contributor
|
Quality pack traceability report for this pull request: Status: PASS (workflow run) |
Contributor
|
Documentation preview for this pull request is available at: |
This branch is waiting to be deployed
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.
Summary
gPTP timestamps must come from a free-running local clock that is never adjusted by the time synchronization itself (
feat_req_time_veh_free_run_ts). Previously, two problems violated this:qnx_raw_shim.cpp) cascaded per-message through BPF hardware timestamp →PTP_GET_TIME(PHC read) →clock_gettime(CLOCK_REALTIME).CLOCK_REALTIMEis the System Clock thatscore::timekeeps aligned to Absolute Time, so it can step between two timestamps and falsify the peer-delay and rate-ratio calculations.raw_socket.cpp) returned an all-zerohwtswith a success code when no hardware timestamp was present, so a missing timestamp was silently treated as a valid timestamp of0byGptpEngine::HandlePacketandPeerDelayMeasurer.Changes
EnableHwTimestamping(); QNX:BIOCSTSTAMPresult atqnx_raw_open()), and never mix sources within one interface's lifetime, so all timestamps of one Sync/Follow_Up evaluation or one peer-delay measurement come from the same clock.CLOCK_MONOTONICon both platforms — neverCLOCK_REALTIME, and never the Linux kernel'sSOF_TIMESTAMPING_*_SOFTWARE(which is itselfCLOCK_REALTIME-based).0.Recv()/Send()return the sentinelkNoHwTimestamp({-1, 0}), andGptpEngine::HandlePacketdiscards the affected message (Sync / Pdelay_Req / Pdelay_Resp) instead of using a fabricated value.SendPDelayResponseAndFollowUpskips sending the Follow_Up when t3 is missing.SelectTimestamp()function so it is unit-testable without a full syscall-DI layer).docs/detailed_design/index.rst) now documents the timestamp sources and the missing-timestamp discard behavior, and removes the inaccurate "fallback does not affect protocol correctness" claim.Acceptance criteria
CLOCK_REALTIME, on QNX and on Linux.Closes #257