1 #ifndef BASE_TIMESTAMP_H
2 #define BASE_TIMESTAMP_H
21 typedef uint64_t LocalStamp_t;
27 typedef double GlobalTime_t;
83 int64_t
distance(LocalStamp_t t1, LocalStamp_t t2)
const
119 if ((shift>0) && (shift < (int64_t)
fWrapSize/2))
LocalStampConverter class should perform conversion of time stamps to time in seconds.
Definition: TimeStamp.h:35
uint64_t fHalfWrapSize
! fWrapSize/2 - used very often in calculations
Definition: TimeStamp.h:39
LocalStamp_t fRef
! reference time, used to detect wraps of timestamp
Definition: TimeStamp.h:43
uint64_t fWrapSize
! value of time stamp which wraps - MUST be power of 2
Definition: TimeStamp.h:38
uint64_t fValueMask
! mask to extract bits related to stamp
Definition: TimeStamp.h:40
~LocalStampConverter()
destructor
Definition: TimeStamp.h:64
void SetTimeSystem(unsigned wrapbits, double coef)
Set major timing parameters - wrap value and coefficient.
Definition: TimeStamp.h:70
double fCoef
! time coefficient to convert to seconds
Definition: TimeStamp.h:46
LocalStampConverter()
constructor
Definition: TimeStamp.h:51
int64_t fT0
! time stamp, used as t0 for time production
Definition: TimeStamp.h:37
int64_t distance(LocalStamp_t t1, LocalStamp_t t2) const
Method calculates distance between two stamps In simplest case just should return t2-t1.
Definition: TimeStamp.h:83
void SetT0(int64_t t0)
set T0
Definition: TimeStamp.h:67
int64_t fConvRef
! value used for time conversion
Definition: TimeStamp.h:44
void MoveRef(LocalStamp_t newref)
Move reference to the new position.
Definition: TimeStamp.h:113
uint64_t fCurrentWrap
! summed wraps since begin
Definition: TimeStamp.h:42
double ToSeconds(LocalStamp_t stamp) const
Method convert time stamp to seconds, taking into account probable wrap relative to fRef value.
Definition: TimeStamp.h:98
uint64_t abs_distance(LocalStamp_t t1, LocalStamp_t t2)
Method returns abs(t1-t2)
Definition: TimeStamp.h:90