Skip to content

drivers/timers, arch/arm/stm32: fix a PTP dummy clock typo and a stale comment. - #20207

Merged
acassis merged 2 commits into
apache:masterfrom
daniel-p-carvalho:fix/ptp-dummy-and-rxtime-comment
Sep 20, 2026
Merged

acassis merged 2 commits into
apache:masterfrom
daniel-p-carvalho:fix/ptp-dummy-and-rxtime-comment

Conversation

@daniel-p-carvalho

Copy link
Copy Markdown
Contributor

Summary

Two small corrections to code that was merged before, both found while checking the PTP clock documentation against the code.

  1. ptp_clock_dummy_getcrosststamp() in drivers/timers/ptp_clock_dummy.c stored the seconds of the monotonic clock in the nanoseconds field of monoraw, so the monotonic time of the cross timestamp was wrong. It now stores the nanoseconds. The two lines above it, for the device and the real-time clock, already copy the right fields.
  2. In arch/arm/src/common/stm32/stm32_eth_m3m4_v1.c the comment of stm32_eth_ptp_convert_rxtime() said that it converts the RX timestamp to CLOCK_REALTIME. Since arch/arm/stm32: implement PTP hardware clock driver (/dev/ptp0) #20180 the function delivers the value of the PTP counter of the MAC, which is the time base of /dev/ptp0, so the comment says that now. It changes no code.

Impact

The first commit changes the value that the dummy PTP clock returns in monoraw for PTP_SYS_OFFSET_PRECISE. Nothing else in the tree reads it. The second commit changes a comment only.

Testing

Both points were confirmed by reading the code. The dummy driver was compiled (syntax check with the ARM toolchain, no warnings) and ./tools/checkpatch.sh passes for both commits. The effect of the first fix was not run: it only shows in the result of PTP_SYS_OFFSET_PRECISE on the dummy clock, for example in a simulator test.

…time.

ptp_clock_dummy_getcrosststamp() stored the seconds of the monotonic
clock in the nanoseconds field of the monoraw member, so the
monotonic time of the cross timestamp was wrong. Store the nanoseconds.

Signed-off-by: Daniel P. Carvalho <danieloak@gmail.com>
Assisted-by: Claude:claude-sonnet-5
The comment of stm32_eth_ptp_convert_rxtime() said that it converts to
CLOCK_REALTIME. Since the timestamp is delivered as the value of the
PTP counter of the MAC, which is the time base of /dev/ptp0, say
that.

Signed-off-by: Daniel P. Carvalho <danieloak@gmail.com>
Assisted-by: Claude:claude-sonnet-5
@github-actions github-actions Bot added Arch: arm Issues related to ARM (32-bit) architecture Area: Drivers Drivers issues Size: XS The size of the change in this PR is very small labels Sep 20, 2026
@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@acassis acassis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice catch!

@acassis
acassis merged commit 3921079 into apache:master Sep 20, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Area: Drivers Drivers issues Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants