#ifndef BASE_TIMESTAMP_H #define BASE_TIMESTAMP_H #include namespace base { /** Current time model * There are three different time representations: * local stamp - 64-bit unsigned integer (LocalStamp_t), can be analyzed only locally * local time - double in seconds (GlobalTime_t), adjust all local differences, should be without wrap * global time - double in seconds (GlobalTime_t), universal time used for global actions like RoI declaration * In case when stream does not required time synchronization local time automatically used as global */ /** type for generic representation of local stamp * if necessary, can be made more complex, * for a moment arbitrary 64-bit value */ typedef uint64_t LocalStamp_t; /** type for global time stamp, valid for all subsystems * should be reasonable values in nanoseconds * for a moment double precision should be enough */ typedef double GlobalTime_t; /** LocalStampConverter class should perform * conversion of time stamps to time in seconds. * Main problem to solve - handle correctly time stamp wraps. */ class LocalStampConverter { protected: int64_t fT0; ///0) && (shift < (int64_t) fWrapSize/2)) fCurrentWrap+=fWrapSize; } fRef = newref; // precalculate value, which will be used for conversion fConvRef = int64_t(fCurrentWrap + fRef) - fT0; } }; } #endif