ADTF  3.18.2
cTimeSynchronizer

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.
 

Detailed Description

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.

Member Function Documentation

◆ AddDatum()

tVoid AddDatum ( tTimeStamp  nInternalTime,
tTimeStamp  nExternalTime 
)

Adds a new data point of internal and extrernal time values to the data collection.

Parameters
nInternalTime[in] Time of internal clock.
nExternalTime[in] Time of external clock, corresponding to the value of the internal clock.
Returns
void
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ GetInternalTime()

tTimeStamp GetInternalTime ( tUInt64  nExternalTime) const

Returns approximated value of internal clock corresponging to given external clock value.

Parameters
nExternalTime[in] Time of external clock.
Returns
Approcimated value of internal clock.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ Reset()

tVoid Reset ( )

Resets object to initial state.

Returns
void
This method is real-time safe.\nSee @ref page_real_time_safe.\n