Thread (20 messages) 20 messages, 3 authors, 7d ago

Re: [PATCH v4 net-next 2/7] selftests/ptp: Extract print_system_timestamp helper in testptp

From: Arthur Kiyanovski <akiyano@amazon.com>
Date: 2026-07-17 07:20:03
Also in: linux-doc, linux-kselftest

On 2026-07-16 14:34:57+03:00, saeed bishara wrote:
quoted
+static void print_system_timestamp(int sample_num, __kernel_clockid_t clockid,
+                                  long long sec, unsigned int nsec,
+                                  const char *when)
+{
+       switch (clockid) {
+       case CLOCK_REALTIME:
+               printf("sample #%2d: real time %s: %lld.%09u\n",
+                      sample_num, when, sec, nsec);
+               break;
+       case CLOCK_MONOTONIC:
+               printf("sample #%2d: monotonic time %s: %lld.%09u\n",
+                      sample_num, when, sec, nsec);
+               break;
+       case CLOCK_MONOTONIC_RAW:
+               printf("sample #%2d: monotonic-raw time %s: %lld.%09u\n",
+                      sample_num, when, sec, nsec);
+               break;
These three printfs are also kind of duplicated, I think mapping the
clockid to name first would save a few lines.
Done in v5 - map the clockid to a name and print once.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help