ADTF
|
Time synchronization helper class for synchronizing value from an external clock to internal clock values. More...
Classes | |
struct | tDatum |
Struct consisting of internal and external time. More... | |
Public Member Functions | |
cTimeSynchronizer () | |
Constructor. | |
tVoid | Reset () |
Resets object to initial state. More... | |
tVoid | AddDatum (tTimeStamp nInternalTime, tTimeStamp nExternalTime) |
Adds a new data point of internal and extrernal time values to the data collection. More... | |
tTimeStamp | GetInternalTime (tUInt64 nExternalTime) const |
Returns approximated value of internal clock corresponging to given external clock value. More... | |
Protected Attributes | |
tDatum | m_aDatum [nMaxDatumCount] |
Data points for synchronization. | |
tDatum | m_oDatumSum |
Sum of all values in m_aDatum. | |
tInt | m_nValidDatumCount |
Number of data points. | |
tInt | m_nLastDatumIndex |
Last index in data array. | |
tFloat64 | m_nOffset |
Offset between internal and external time. | |
tFloat64 | m_nScale |
Scale difference between internal and external time. | |
tFloat64 | m_nErrorLimit |
Error limit for accepting or rejecting new data points. | |
Static Private Attributes | |
static const int | nMaxDatumCount = 16 |
Maximum number of data points. | |
Time synchronization helper class for synchronizing value from an external clock to internal clock values.
For the computation a simple linear regression algorithm is used. Maverick values are filtered by a variable percental treshold.
Definition at line 21 of file timesynchronizer.h.
tVoid AddDatum | ( | tTimeStamp | nInternalTime, |
tTimeStamp | nExternalTime | ||
) |
Adds a new data point of internal and extrernal time values to the data collection.
nInternalTime | [in] Time of internal clock. |
nExternalTime | [in] Time of external clock, corresponding to the value of the internal clock. |
tTimeStamp GetInternalTime | ( | tUInt64 | nExternalTime | ) | const |
Returns approximated value of internal clock corresponging to given external clock value.
nExternalTime | [in] Time of external clock. |
tVoid Reset | ( | ) |
Resets object to initial state.