mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-23 22:53:43 +00:00
[traffxml] Introduce timestamp shift operation
Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
@@ -153,6 +153,12 @@ IsoTime::IsoTime(std::chrono::time_point<std::chrono::utc_clock> tp)
|
||||
bool IsoTime::IsPast()
|
||||
{
|
||||
return m_tp < std::chrono::utc_clock::now();
|
||||
}\
|
||||
|
||||
void IsoTime::Shift(IsoTime nowRef)
|
||||
{
|
||||
auto const offset = std::chrono::utc_clock::now() - nowRef.m_tp;
|
||||
m_tp += offset;
|
||||
}
|
||||
|
||||
bool IsoTime::operator< (IsoTime & rhs)
|
||||
@@ -256,6 +262,18 @@ std::optional<TrafficImpact> TraffMessage::GetTrafficImpact()
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void TraffMessage::ShiftTimestamps()
|
||||
{
|
||||
IsoTime nowRef = m_updateTime;
|
||||
m_receiveTime.Shift(nowRef);
|
||||
m_updateTime.Shift(nowRef);
|
||||
m_expirationTime.Shift(nowRef);
|
||||
if (m_startTime)
|
||||
m_startTime.value().Shift(nowRef);
|
||||
if (m_endTime)
|
||||
m_endTime.value().Shift(nowRef);
|
||||
}
|
||||
|
||||
void MergeMultiMwmColoring(MultiMwmColoring & delta, MultiMwmColoring & target)
|
||||
{
|
||||
// for each mwm in delta
|
||||
|
||||
Reference in New Issue
Block a user