diff options
author | aap <aap@papnet.eu> | 2020-01-31 12:57:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-31 12:57:25 +0100 |
commit | 8b367e8d18599400b5e5e5b827f191e6bcb5ffb4 (patch) | |
tree | 4ef2e1fc1aee31f7b96d276cff8a7fb83b5f1f1e /src/save/Date.cpp | |
parent | Merge pull request #300 from Sergeanur/Remote (diff) | |
parent | sizeofs n stuff (diff) | |
download | re3-8b367e8d18599400b5e5e5b827f191e6bcb5ffb4.tar re3-8b367e8d18599400b5e5e5b827f191e6bcb5ffb4.tar.gz re3-8b367e8d18599400b5e5e5b827f191e6bcb5ffb4.tar.bz2 re3-8b367e8d18599400b5e5e5b827f191e6bcb5ffb4.tar.lz re3-8b367e8d18599400b5e5e5b827f191e6bcb5ffb4.tar.xz re3-8b367e8d18599400b5e5e5b827f191e6bcb5ffb4.tar.zst re3-8b367e8d18599400b5e5e5b827f191e6bcb5ffb4.zip |
Diffstat (limited to '')
-rw-r--r-- | src/save/Date.cpp | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/src/save/Date.cpp b/src/save/Date.cpp new file mode 100644 index 00000000..ca75bb5e --- /dev/null +++ b/src/save/Date.cpp @@ -0,0 +1,91 @@ +#include "common.h" +#include "Date.h" + +CDate::CDate() +{ + m_nYear = 0; + m_nSecond = 0; + m_nMinute = 0; + m_nHour = 0; + m_nDay = 0; + m_nMonth = 0; +} + +bool +CDate::operator>(const CDate &right) +{ + if (m_nYear > right.m_nYear) + return true; + if (m_nYear != right.m_nYear) + return false; + + if (m_nMonth > right.m_nMonth) + return true; + if (m_nMonth != right.m_nMonth) + return false; + + if (m_nDay > right.m_nDay) + return true; + if (m_nDay != right.m_nDay) + return false; + + if (m_nHour > right.m_nHour) + return true; + if (m_nHour != right.m_nHour) + return false; + + if (m_nMinute > right.m_nMinute) + return true; + if (m_nMinute != right.m_nMinute) + return false; + return m_nSecond > right.m_nSecond; +} + +bool +CDate::operator<(const CDate &right) +{ + if (m_nYear < right.m_nYear) + return true; + if (m_nYear != right.m_nYear) + return false; + + if (m_nMonth < right.m_nMonth) + return true; + if (m_nMonth != right.m_nMonth) + return false; + + if (m_nDay < right.m_nDay) + return true; + if (m_nDay != right.m_nDay) + return false; + + if (m_nHour < right.m_nHour) + return true; + if (m_nHour != right.m_nHour) + return false; + + if (m_nMinute < right.m_nMinute) + return true; + if (m_nMinute != right.m_nMinute) + return false; + return m_nSecond < right.m_nSecond; +} + +bool +CDate::operator==(const CDate &right) +{ + if (m_nYear != right.m_nYear || m_nMonth != right.m_nMonth || m_nDay != right.m_nDay || m_nHour != right.m_nHour || m_nMinute != right.m_nMinute) + return false; + return m_nSecond == right.m_nSecond; +} + +void +CDate::PopulateDateFields(int8 &second, int8 &minute, int8 &hour, int8 &day, int8 &month, int16 year) +{ + m_nSecond = second; + m_nMinute = minute; + m_nHour = hour; + m_nDay = day; + m_nMonth = month; + m_nYear = year; +}
\ No newline at end of file |