diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-09-14 21:21:47 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-09-14 21:21:47 +0100 |
| commit | ee05b1c06aa5305b5c97dc74dc8f253bab99a2ac (patch) | |
| tree | c9dfa056c5e9c3d828719eabf4fbd52986df9d90 /src/local_time.cc | |
| parent | 6fef005944fa5613cb6395624781bfcc6c605d83 (diff) | |
Add operator< for LocalTime.
Diffstat (limited to 'src/local_time.cc')
| -rw-r--r-- | src/local_time.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/local_time.cc b/src/local_time.cc index 647ff35d..401bd9d7 100644 --- a/src/local_time.cc +++ b/src/local_time.cc @@ -213,6 +213,27 @@ LocalTime::operator== (LocalTime const & other) const } bool +LocalTime::operator< (LocalTime const & other) const +{ + if (_year != other._year) { + return _year < other._year; + } + if (_month != other._month) { + return _month < other._month; + } + if (_day != other._day) { + return _day < other._day; + } + if (_hour != other._hour) { + return _hour < other._hour; + } + if (_second != other._second) { + return _second < other._second; + } + return _millisecond < other._millisecond; +} + +bool LocalTime::operator!= (LocalTime const & other) const { return !(*this == other); |
