Thread (26 messages) 26 messages, 6 authors, 3h ago

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

From: saeed bishara <hidden>
Date: 2026-07-16 11:35:09
Also in: linux-doc, linux-kselftest

+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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help