diff options
Autocommit at 01.05.2022 @ 08:55
2 files changed, 14 insertions, 0 deletions
| -rw-r--r-- | src/DateTime/DateTime.cpp | 8 | ||||
| -rw-r--r-- | src/DateTime/DateTime.h | 6 |
diff --git a/src/DateTime/DateTime.cpp b/src/DateTime/DateTime.cpp index e8334a3..e0c20cc 100644 --- a/src/DateTime/DateTime.cpp +++ b/src/DateTime/DateTime.cpp @@ -1,5 +1,13 @@ #include "DateTime.h" +/* Private */ + +bool DateTime::isLeapYear() { + return year % 400 == 0 || (year % 100 != 0 && year % 4 == 0); +} + +/* Public */ + DateTime::DateTime(unsigned short hour, unsigned short minute, unsigned short day, unsigned short month, unsigned short year) { this->hour = hour; this->minute = minute; diff --git a/src/DateTime/DateTime.h b/src/DateTime/DateTime.h index ff01d7b..f8753ce 100644 --- a/src/DateTime/DateTime.h +++ b/src/DateTime/DateTime.h @@ -8,18 +8,24 @@ class DateTime { unsigned short month; unsigned short year; + bool isLeapYear(); + public: 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(); bool set_hour(unsigned short newHour); + unsigned short get_minute(); bool set_minute(unsigned short newMinute); + unsigned short get_day(); bool set_day(unsigned short newDay); + unsigned short get_month(); bool set_month(unsigned short newMonth); + unsigned short get_year(); bool set_year(unsigned short newYear); }; |
