From a39bdee0d17e73e34b17e2209e2a6ea77fbe25ec Mon Sep 17 00:00:00 2001 From: mvglasow Date: Fri, 16 May 2025 18:07:02 +0300 Subject: [PATCH] [traffic] Refactor IsoTime comparison operators Signed-off-by: mvglasow --- traffxml/traff_model.cpp | 8 ++++---- traffxml/traff_model.hpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/traffxml/traff_model.cpp b/traffxml/traff_model.cpp index ec981e489..e7cd9a515 100644 --- a/traffxml/traff_model.cpp +++ b/traffxml/traff_model.cpp @@ -145,16 +145,16 @@ bool IsoTime::IsPast() return t_tm < t_now; } -bool operator< (IsoTime lhs, IsoTime rhs) +bool IsoTime::operator< (IsoTime & rhs) { - std::time_t t_lhs = std::mktime(&lhs.m_tm); + std::time_t t_lhs = std::mktime(&m_tm); std::time_t t_rhs = std::mktime(&rhs.m_tm); return t_lhs < t_rhs; } -bool operator> (IsoTime lhs, IsoTime rhs) +bool IsoTime::operator> (IsoTime & rhs) { - std::time_t t_lhs = std::mktime(&lhs.m_tm); + std::time_t t_lhs = std::mktime(&m_tm); std::time_t t_rhs = std::mktime(&rhs.m_tm); return t_lhs > t_rhs; } diff --git a/traffxml/traff_model.hpp b/traffxml/traff_model.hpp index 0ab998e94..b73c28ce5 100644 --- a/traffxml/traff_model.hpp +++ b/traffxml/traff_model.hpp @@ -74,8 +74,8 @@ public: */ bool IsPast(); - friend bool operator< (IsoTime lhs, IsoTime rhs); - friend bool operator> (IsoTime lhs, IsoTime rhs); + bool operator< (IsoTime & rhs); + bool operator> (IsoTime & rhs); private: friend std::string DebugPrint(IsoTime time);