Commit Graph

13 Commits (d52ef498cf999d411fb7261753219aa1463bc7c1)

Author SHA1 Message Date
Richard Cochran 7a2013360a tmv: Add a method to convert to a struct Timestamp.
This will be needed in order to generate a TLV for the NSM protocol.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-08 07:20:42 -08:00
Michael Brown d432cdc52a tmv: Convert tmv_t to a non-scalar type
Enforce the use of the tmv_t wrapper functions by converting tmv_t
from an int64_t to a struct containing an int64_t.

Inspection of the disassembly shows that this change has essentially
no impact on the resulting object code, at least for x86_64 with
compiler optimisations enabled.

RC:
  - Fixed up after dropping one previous patch in the series.
  - Removed the new function, tmv_to_Timestamp, as that will
    be introduced later on.

Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2018-03-07 11:39:28 -08:00
Michael Brown ffc5b93f95 tmv: Add tmv_sign()
The sign of time values is tested in tsproc.c.  Add an abstraction
tmv_sign() to return the sign of a time value.

Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
2018-03-07 07:55:51 -08:00
Michael Brown 1b7ff890be tmv: Generalise tmv_eq() to tmv_cmp()
Time values are compared using an inequality test in mmedian.c
Generalise tmv_eq() to tmv_cmp() (by analogy with memcmp()) and
replace existing uses of tmv_eq().

Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
2018-03-07 07:55:51 -08:00
Delio Brignoli bd001fdec7 port: adjust peer delay calculation using neighborRateRatio
Previouly the peer delay was not taking into account the
frequency offset between the local clock and the peer's clock.
Reset neighborRateRatio to 1.0 in port_nrate_initialize().

Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
2014-02-25 14:13:05 +01:00
Richard Cochran 4e09ff8585 Introduce a helper function to convert from tmv to nanoseconds.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-12 17:30:37 +02:00
Richard Cochran f3b0ca69d3 trivial: fix a spelling error in a comment.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-12 17:30:37 +02:00
Richard Cochran 8f5bd0edda Guard against divide by zero.
If a buggy driver or hardware delivers bogus time stamps, then we might
crash with a divide by zero exception.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-09-04 08:16:53 +02:00
Richard Cochran 95598b4fde Provide a conversion function from tmv to double.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-31 17:28:14 +02:00
Richard Cochran 92c6c9149d Maintain the current data set.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-08-22 07:36:33 +02:00
Richard Cochran e38488ae48 Add time value operations to clear to zero and test for zero.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2012-03-11 10:46:45 +01:00
Richard Cochran 56a5adc1cc Smooth the path delay estimate with a moving average.
This is really just a first attempt using a hard coded length. Probably
it will be necessary to let the length be configurable and/or adaptable.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2011-11-27 14:24:03 +01:00
Richard Cochran fc378711d8 Add an abstract time value type.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2011-11-12 13:58:28 +01:00