mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-24 06:53:46 +00:00
[traffxml] Introduce timestamp shift operation
Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
@@ -72,6 +72,17 @@ public:
|
||||
*/
|
||||
bool IsPast();
|
||||
|
||||
/**
|
||||
* @brief Shifts time to the present.
|
||||
*
|
||||
* This method is intended for testing. It shifts the timestamp by a fixed amount, so that
|
||||
* `nowRef` corresponds to current time. After this method returns, the timestamp will have the
|
||||
* same offset from current time that it had from `nowRef` at the time the call was made.
|
||||
*
|
||||
* @param nowRef
|
||||
*/
|
||||
void Shift(IsoTime nowRef);
|
||||
|
||||
bool operator< (IsoTime & rhs);
|
||||
bool operator> (IsoTime & rhs);
|
||||
private:
|
||||
@@ -362,6 +373,16 @@ struct TraffMessage
|
||||
*/
|
||||
std::optional<TrafficImpact> GetTrafficImpact();
|
||||
|
||||
/**
|
||||
* @brief Shifts timestamps to the present.
|
||||
*
|
||||
* This method is intended for testing. It shifts the timestamps of the message by a fixed amount,
|
||||
* so that `m_updateTime` corresponds to current time, and all other timestamps maintain their
|
||||
* offset to `m_updateTime`. If `m_startTime` and/or `m_endTime` are set, they may be adjusted
|
||||
* further to maintain their offset from midnight or the full hour (currently not implemented).
|
||||
*/
|
||||
void ShiftTimestamps();
|
||||
|
||||
std::string m_id;
|
||||
IsoTime m_receiveTime = IsoTime::Now();
|
||||
IsoTime m_updateTime = IsoTime::Now();
|
||||
|
||||
Reference in New Issue
Block a user