Website Summary Files Commits Branches @commit @diff @stats
path: root / src / DateTime
diff options
context:
space:
mode:
Commitbdf33676953751811f382c9dfbd73d55bcdfc6c5 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-01 08:45:39 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-01 08:45:39 +0300
Files3776587a6ee37d187a3f7adde192ff9f325e7d5a /src/DateTime
FMI-OOP-P1_TicketSystem-bdf33676953751811f382c9dfbd73d55bcdfc6c5.tar
FMI-OOP-P1_TicketSystem-bdf33676953751811f382c9dfbd73d55bcdfc6c5.tar.gz
FMI-OOP-P1_TicketSystem-bdf33676953751811f382c9dfbd73d55bcdfc6c5.zip
Parent1a3226cf3ae0c986317a870401a2eba29a8129ad (diff)
Autocommit at 01.05.2022 @ 08:45
2 files changed, 20 insertions, 7 deletions
-rw-r--r--src/DateTime/DateTime.cpp6
-rw-r--r--src/DateTime/DateTime.h21
diff --git a/src/DateTime/DateTime.cpp b/src/DateTime/DateTime.cpp
index 544182c..448fefb 100644
--- a/src/DateTime/DateTime.cpp
+++ b/src/DateTime/DateTime.cpp
@@ -1,6 +1,8 @@
#include "DateTime.h"
-DateTime::DateTime(unsigned char hour, unsigned char minute, unsigned char day, unsigned char month, unsigned short year) {
+DateTime::DateTime(unsigned short hour, unsigned short minute, unsigned short day, unsigned short month, unsigned short year) {
+ this->hour = hour;
+ this->minute = minute;
this->day = day;
this->month = month;
this->year = year;
@@ -9,5 +11,5 @@ DateTime::DateTime(unsigned char hour, unsigned char minute, unsigned char day,
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;
+ return year > other.year || month > other.month || day > other.day || hour > other.hour || minute > other.minute;
}
diff --git a/src/DateTime/DateTime.h b/src/DateTime/DateTime.h
index 6d6df46..2327ca5 100644
--- a/src/DateTime/DateTime.h
+++ b/src/DateTime/DateTime.h
@@ -2,15 +2,26 @@
#define HEADER_DATETIME
class DateTime {
- unsigned char hour;
- unsigned char minute;
- unsigned char day;
- unsigned char month;
+ unsigned short hour;
+ unsigned short minute;
+ unsigned short day;
+ unsigned short month;
unsigned short year;
public:
- DateTime(unsigned char hour, unsigned char minute, unsigned char day, unsigned char month, unsigned short year);
+ DateTime(unsigned short hour, unsigned short minute, unsigned short day, unsigned short month, unsigned short year);
int compare(const DateTime& other);
+
+ unsigned short get_hour();
+ unsigned short set_hour();
+ unsigned short get_minute();
+ unsigned short set_mintue();
+ unsigned short get_day();
+ unsigned short set_day();
+ unsigned short get_month();
+ unsigned short set_month();
+ unsigned short get_year();
+ unsigned short set_year();
};
#endif