mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 13:23:59 +00:00
[traffic] Refactor IsoTime comparison operators
Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user