Context: The FFclock paradigm is a dual (absolute,difference) clock
design. The difference clock is defined as part of natFFC.
Reading a difference clock requires three quantities: {rts1,rts2,p}, to
enable the calculation of the time difference ∆T = p*(rts2-rts1), where
the value of p of the counter period must be local to the Raw TimeStamps
rts1, rts2 (which moreover must not be too far apart). To assist in
such difference clock reading, helper interfaces can be defined, for
example see kern_ffclock.c:ffclock_difftime.
This commit adds a new clock to the FFclock family, "diffFFC", to
support difference clock use via a traditional timestamp interface
consisting of a single absolute timestamp. Like natFFC, diffFFC tracks
absolute time per-tick using the counter period of natFFC, but the jumps
inherent in natFFC updates are excluded, as are leap seconds.
Thus diffFFC begins synchronized to UTC but will then gracefully drift
from it. It can be used to provide difference clock functionality via an
absolute timestamp interface via ∆T = ts2-ts1 where ts1, ts2 are two
diffFFC timestamps, with the added benefit that ts1, ts2 carry (roughly)
UTC meaning. The diffFFC is also monotonic and so can be used for
temporal ordering. The diffFFC should not be used for absolute timestamps,
instead natFFC or monoFFC are available.
A bintime member "tick_time_diff" is added to struct fftimehands
to hold the per-tick updated value of the diffFFC. Associated update
code is given in ffclock_windup.
To extent clock reading to the new FFclock, a FFCLOCK_DIFF flag value is
added in timeffc.h, and acted on in kern_tc.c functions
ffclock_last_tick, ffclock_convert_abs}, and sysclock_snap2bintime.
Improved comment blocks on the topic are given in timeffc.h and
kern_ffclock.c:ffclock_abstime.
Additionally in sysclock_snap2bintime:
- addition of safeguards preventing incompatible flag combinations from producing flawed outputs, documented in the header comment block. In particular this ensures that the diffFFC comes in only a single flavour which obeys difference clock requirements.
- bug: FAST flags were missing in some places (must make distinction between whether fast was used in the original capture, or here during defered conversion).