diff options
Autocommit at 01.05.2022 @ 08:40
1 files changed, 4 insertions, 2 deletions
| -rw-r--r-- | src/DateTime/DateTime.cpp | 6 |
diff --git a/src/DateTime/DateTime.cpp b/src/DateTime/DateTime.cpp index cb30268..544182c 100644 --- a/src/DateTime/DateTime.cpp +++ b/src/DateTime/DateTime.cpp @@ -6,6 +6,8 @@ DateTime::DateTime(unsigned char hour, unsigned char minute, unsigned char day, this->year = year; } -DateTime::compare(const DateTime& other) { - +int DateTime::compare(const DateTime& other) { + if (year < other.year || month < other.month || day < other.day || hour < other.hour || minute < other.minute) + return -1; + return year > other.year && month > other.month && day > other.day && hour > other.hour && minute > other.minute; } |
