[traffic] Refactor IsoTime comparison operators

Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
mvglasow
2025-05-16 18:07:02 +03:00
parent 136293c308
commit a39bdee0d1
2 changed files with 6 additions and 6 deletions

View File

@@ -145,16 +145,16 @@ bool IsoTime::IsPast()
return t_tm < t_now; 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); std::time_t t_rhs = std::mktime(&rhs.m_tm);
return t_lhs < t_rhs; 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); std::time_t t_rhs = std::mktime(&rhs.m_tm);
return t_lhs > t_rhs; return t_lhs > t_rhs;
} }

View File

@@ -74,8 +74,8 @@ public:
*/ */
bool IsPast(); bool IsPast();
friend bool operator< (IsoTime lhs, IsoTime rhs); bool operator< (IsoTime & rhs);
friend bool operator> (IsoTime lhs, IsoTime rhs); bool operator> (IsoTime & rhs);
private: private:
friend std::string DebugPrint(IsoTime time); friend std::string DebugPrint(IsoTime time);