A double rounds an epoch-nanosecond timestamp to 256 ns
Symptom#
An analysis of nanosecond timestamps (about 1.8e18 ns since 1970) gives results in steps: every median of a half-difference is a multiple of 0.128 us, and small effects jump between neighbouring steps. The raw timestamps in the trace are not quantized: they take every value modulo 256.
Cause#
A double has a 53-bit mantissa. Near 1.8e18 the gap between two doubles is 256 ns, so float(ts) rounds each timestamp by up to 128 ns. The code converted stamps with float (errors_cpu(rs, float, float)), and a clock mapping did its absolute arithmetic in doubles ((ts - offset + skew * anchor) / (1 + skew)). Python ints are exact; the loss happens only at the conversion.
Fix#
- Keep absolute timestamps as Python
int. - Subtract an anchor first, in integers, then use floats only on the small offset:
anchor + round((ts - offset - anchor) / (1 + skew)). - Check for the symptom: if results are multiples of 128 ns or 256 ns, look for a
float()on an absolute timestamp.
Evidence#
dpucrumbs E2 clock-error analysis, 2026-09-30 (fix in commit 4ee36ae). Arm C medians moved from multiples of 0.128 us (-0.13, -0.26, 1.54) to -0.11, -0.27, 1.42; trace stamps of doca_task_submit events took all 256 values modulo 256.
Also found by searching
- every median is a multiple of 0.128 us
- nanosecond timestamps lose precision in the analysis
- how do I compute differences of epoch nanosecond timestamps without losing precision
- float of a 1.8e18 ns timestamp rounds to 256 ns