From d1ed2647b9ed99571a33fc40ab2372cb7999bef0 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 19 Jan 2023 12:45:49 +0100 Subject: Add some more operators to LocalTime. --- src/local_time.cc | 15 +++++++++++++++ src/local_time.h | 2 ++ 2 files changed, 17 insertions(+) (limited to 'src') diff --git a/src/local_time.cc b/src/local_time.cc index 659d5c82..0f87bb49 100644 --- a/src/local_time.cc +++ b/src/local_time.cc @@ -308,6 +308,14 @@ LocalTime::operator< (LocalTime const & other) const } +bool +LocalTime::operator<=(LocalTime const& other) const +{ + return *this < other || *this == other; +} + + + bool LocalTime::operator>(LocalTime const & other) const { @@ -336,6 +344,13 @@ LocalTime::operator>(LocalTime const & other) const } +bool +LocalTime::operator>=(LocalTime const& other) const +{ + return *this > other || *this == other; +} + + bool LocalTime::operator!= (LocalTime const & other) const { diff --git a/src/local_time.h b/src/local_time.h index e1baedcc..7c91db3e 100644 --- a/src/local_time.h +++ b/src/local_time.h @@ -157,7 +157,9 @@ public: bool operator== (LocalTime const & other) const; bool operator!= (LocalTime const & other) const; bool operator< (LocalTime const & other) const; + bool operator<=(LocalTime const & other) const; bool operator>(LocalTime const & other) const; + bool operator>=(LocalTime const & other) const; private: friend struct ::local_time_basic_test; -- cgit v1.2.3