From 1a3226cf3ae0c986317a870401a2eba29a8129ad Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 1 May 2022 08:40:37 +0300 Subject: Autocommit at 01.05.2022 @ 08:40 --- src/DateTime/DateTime.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/DateTime/DateTime.cpp') 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; } -- cgit v1.3.1-23-gd82d