the current date version in Ubuntu 26.04 has an issue where it drops the
leading zeros in the nanosecond field before truncating it for %
coreutils date drops the nanosecond field before %<width>.

Issue with date is recored at
https://github.com/uutils/coreutils/issues/15697

until Ubuntu picks up a version with the fix pass the only the whole
second part of the timestamp to date -d and create the fractional second
manually.

Fixes: e3db589c7eeb ("pinctrl: Fan out multicast querier queries per port.")
Assisted-by: Qwen3.8-27B-FP8, opencode
Signed-off-by: Jacob Tanenbaum <[email protected]>

diff --git a/tests/ovn.at b/tests/ovn.at
index 780149467..e8a59d283 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -26422,9 +26422,18 @@ packet_out_ts() {
     dnl Prints the send time (in ms) of the $1-th OFPT_PACKET_OUT
     dnl message in hv1/ovs-vswitchd.log.  The first field of a log
     dnl line is the UTC timestamp with millisecond precision.
+    dnl
+    dnl Only the whole-second part is passed to date(1) and the
+    dnl millisecond field is taken from the timestamp itself.
+    dnl Older coreutils versions silently ignore fractional seconds
+    dnl in date(1) input, in which case %3N would report the current
+    dnl time and the computed intervals would be random.
     grep "received: OFPT_PACKET_OUT" hv1/ovs-vswitchd.log \
         | awk -F'|' -v n="$1" 'NR==n { print $1 }' \
-        | while read -r ts; do date -d "$ts" +%s%3N; done
+        | while read -r ts; do
+            ms=${ts##*.}; ms=${ms%Z}
+            echo $(( $(date -d "${ts%%.*}Z" +%s) * 1000 + 10#$ms ))
+          done
 }
 round_time() {
     dnl The IGMP query of round $1 is the (2n-1)-th OFPT_PACKET_OUT.
-- 
2.56.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to