[traffxml] Purge expired messages

Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
mvglasow
2025-06-15 16:40:03 +03:00
parent db3ed87b92
commit f31541efb2
6 changed files with 86 additions and 5 deletions

View File

@@ -195,6 +195,21 @@ bool operator==(TraffLocation const & lhs, TraffLocation const & rhs)
&& (lhs.m_to == rhs.m_to);
}
IsoTime TraffMessage::GetEffectiveExpirationTime()
{
IsoTime result = m_expirationTime;
if (m_startTime && m_startTime.value() > result)
result = m_startTime.value();
if (m_endTime && m_endTime.value() > result)
result = m_endTime.value();
return result;
}
bool TraffMessage::IsExpired(IsoTime now)
{
return GetEffectiveExpirationTime() < now;
}
std::optional<TrafficImpact> TraffMessage::GetTrafficImpact()
{
// no events, no impact