* [PATCH] selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET
@ 2023-06-15 8:34 Alex Maftei
2023-06-15 9:43 ` Pavan Chebbi
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Alex Maftei @ 2023-06-15 8:34 UTC (permalink / raw)
To: richardcochran, shuah; +Cc: Alex Maftei, linux-kselftest, linux-kernel, netdev
Previously, timestamps were printed using "%lld.%u" which is incorrect
for nanosecond values lower than 100,000,000 as they're fractional
digits, therefore leading zeros are meaningful.
This patch changes the format strings to "%lld.%09u" in order to add
leading zeros to the nanosecond value.
Fixes: 568ebc5985f5 ("ptp: add the PTP_SYS_OFFSET ioctl to the testptp program")
Fixes: 4ec54f95736f ("ptp: Fix compiler warnings in the testptp utility")
Fixes: 6ab0e475f1f3 ("Documentation: fix misc. warnings")
Signed-off-by: Alex Maftei <alex.maftei@amd.com>
---
tools/testing/selftests/ptp/testptp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/ptp/testptp.c b/tools/testing/selftests/ptp/testptp.c
index 198ad5f32187..cfa9562f3cd8 100644
--- a/tools/testing/selftests/ptp/testptp.c
+++ b/tools/testing/selftests/ptp/testptp.c
@@ -502,11 +502,11 @@ int main(int argc, char *argv[])
interval = t2 - t1;
offset = (t2 + t1) / 2 - tp;
- printf("system time: %lld.%u\n",
+ printf("system time: %lld.%09u\n",
(pct+2*i)->sec, (pct+2*i)->nsec);
- printf("phc time: %lld.%u\n",
+ printf("phc time: %lld.%09u\n",
(pct+2*i+1)->sec, (pct+2*i+1)->nsec);
- printf("system time: %lld.%u\n",
+ printf("system time: %lld.%09u\n",
(pct+2*i+2)->sec, (pct+2*i+2)->nsec);
printf("system/phc clock time offset is %" PRId64 " ns\n"
"system clock time delay is %" PRId64 " ns\n",
--
2.28.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET
2023-06-15 8:34 [PATCH] selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET Alex Maftei
@ 2023-06-15 9:43 ` Pavan Chebbi
2023-06-15 19:50 ` Jakub Kicinski
2023-06-15 19:30 ` Richard Cochran
2023-06-15 22:10 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Pavan Chebbi @ 2023-06-15 9:43 UTC (permalink / raw)
To: Alex Maftei; +Cc: richardcochran, shuah, linux-kselftest, linux-kernel, netdev
[-- Attachment #1: Type: text/plain, Size: 2049 bytes --]
On Thu, Jun 15, 2023 at 2:05 PM Alex Maftei <alex.maftei@amd.com> wrote:
>
> Previously, timestamps were printed using "%lld.%u" which is incorrect
> for nanosecond values lower than 100,000,000 as they're fractional
> digits, therefore leading zeros are meaningful.
>
> This patch changes the format strings to "%lld.%09u" in order to add
> leading zeros to the nanosecond value.
>
> Fixes: 568ebc5985f5 ("ptp: add the PTP_SYS_OFFSET ioctl to the testptp program")
> Fixes: 4ec54f95736f ("ptp: Fix compiler warnings in the testptp utility")
> Fixes: 6ab0e475f1f3 ("Documentation: fix misc. warnings")
> Signed-off-by: Alex Maftei <alex.maftei@amd.com>
> ---
> tools/testing/selftests/ptp/testptp.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
Change looks good but can you mark this for "net" correctly and get
CI/sanity checks done.
> diff --git a/tools/testing/selftests/ptp/testptp.c b/tools/testing/selftests/ptp/testptp.c
> index 198ad5f32187..cfa9562f3cd8 100644
> --- a/tools/testing/selftests/ptp/testptp.c
> +++ b/tools/testing/selftests/ptp/testptp.c
> @@ -502,11 +502,11 @@ int main(int argc, char *argv[])
> interval = t2 - t1;
> offset = (t2 + t1) / 2 - tp;
>
> - printf("system time: %lld.%u\n",
> + printf("system time: %lld.%09u\n",
> (pct+2*i)->sec, (pct+2*i)->nsec);
> - printf("phc time: %lld.%u\n",
> + printf("phc time: %lld.%09u\n",
> (pct+2*i+1)->sec, (pct+2*i+1)->nsec);
> - printf("system time: %lld.%u\n",
> + printf("system time: %lld.%09u\n",
> (pct+2*i+2)->sec, (pct+2*i+2)->nsec);
> printf("system/phc clock time offset is %" PRId64 " ns\n"
> "system clock time delay is %" PRId64 " ns\n",
> --
> 2.28.0
>
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET
2023-06-15 9:43 ` Pavan Chebbi
@ 2023-06-15 19:50 ` Jakub Kicinski
0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2023-06-15 19:50 UTC (permalink / raw)
To: Pavan Chebbi
Cc: Alex Maftei, richardcochran, shuah, linux-kselftest, linux-kernel,
netdev
On Thu, 15 Jun 2023 15:13:27 +0530 Pavan Chebbi wrote:
> Change looks good but can you mark this for "net" correctly and get
> CI/sanity checks done.
It may be failing path selection, bot needs some changes in what it
considers "networking", tools/testing/selftests/ptp is not on the list.
If you have a few cycles feel free to extend this list:
https://github.com/kuba-moo/nipa/blob/master/netdev/tree_match.py#L47
post a PR on GH, I'll merge it in.
The patch is just a test fix, not worth reposting, IMHO.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET
2023-06-15 8:34 [PATCH] selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET Alex Maftei
2023-06-15 9:43 ` Pavan Chebbi
@ 2023-06-15 19:30 ` Richard Cochran
2023-06-15 22:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Richard Cochran @ 2023-06-15 19:30 UTC (permalink / raw)
To: Alex Maftei; +Cc: shuah, linux-kselftest, linux-kernel, netdev
On Thu, Jun 15, 2023 at 09:34:04AM +0100, Alex Maftei wrote:
> Previously, timestamps were printed using "%lld.%u" which is incorrect
> for nanosecond values lower than 100,000,000 as they're fractional
> digits, therefore leading zeros are meaningful.
>
> This patch changes the format strings to "%lld.%09u" in order to add
> leading zeros to the nanosecond value.
>
> Fixes: 568ebc5985f5 ("ptp: add the PTP_SYS_OFFSET ioctl to the testptp program")
> Fixes: 4ec54f95736f ("ptp: Fix compiler warnings in the testptp utility")
> Fixes: 6ab0e475f1f3 ("Documentation: fix misc. warnings")
> Signed-off-by: Alex Maftei <alex.maftei@amd.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET
2023-06-15 8:34 [PATCH] selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET Alex Maftei
2023-06-15 9:43 ` Pavan Chebbi
2023-06-15 19:30 ` Richard Cochran
@ 2023-06-15 22:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-06-15 22:10 UTC (permalink / raw)
To: Alex Maftei; +Cc: richardcochran, shuah, linux-kselftest, linux-kernel, netdev
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 15 Jun 2023 09:34:04 +0100 you wrote:
> Previously, timestamps were printed using "%lld.%u" which is incorrect
> for nanosecond values lower than 100,000,000 as they're fractional
> digits, therefore leading zeros are meaningful.
>
> This patch changes the format strings to "%lld.%09u" in order to add
> leading zeros to the nanosecond value.
>
> [...]
Here is the summary with links:
- selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET
https://git.kernel.org/netdev/net/c/76a4c8b82938
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-06-15 22:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-15 8:34 [PATCH] selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET Alex Maftei
2023-06-15 9:43 ` Pavan Chebbi
2023-06-15 19:50 ` Jakub Kicinski
2023-06-15 19:30 ` Richard Cochran
2023-06-15 22:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).