summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-01-19 12:45:49 +0100
committerCarl Hetherington <cth@carlh.net>2023-01-19 12:45:49 +0100
commitd1ed2647b9ed99571a33fc40ab2372cb7999bef0 (patch)
treef50a721c5ffa8010202531fa3b85c0682f5efcdb /src
parentcedab18b03fa06370b78355937be10c104cf0aad (diff)
Add some more operators to LocalTime.
Diffstat (limited to 'src')
-rw-r--r--src/local_time.cc15
-rw-r--r--src/local_time.h2
2 files changed, 17 insertions, 0 deletions
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
@@ -309,6 +309,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
{
auto a = as_utc();
@@ -337,6 +345,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
{
return !(*this == other);
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;