diff options
author | Hop311 <Hop3114@gmail.com> | 2023-05-22 17:54:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-22 17:54:15 +0200 |
commit | 08ec6fe5fbf52d814d88c235aac84bb95ad4e322 (patch) | |
tree | 136a221eb5e7c895c8219778b3d206f2ed9e8e7f /src/openvic/Date.hpp | |
parent | 15e960f93ced8c94a6a45ebb2b44d0705ff7f8f6 (diff) | |
parent | 7874702f30d5855319faf197b10aed31f07f5e27 (diff) |
Merge pull request #5 from OpenVicProject/bmp
BMP palette parser + code style cleanup
Diffstat (limited to 'src/openvic/Date.hpp')
-rw-r--r-- | src/openvic/Date.hpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/openvic/Date.hpp b/src/openvic/Date.hpp index 61de9ba..151b4e5 100644 --- a/src/openvic/Date.hpp +++ b/src/openvic/Date.hpp @@ -1,15 +1,17 @@ #pragma once #include <cstdint> -#include <string> #include <ostream> +#include <string> namespace OpenVic { // A relative period between points in time, measured in days struct Timespan { using day_t = int64_t; + private: day_t days; + public: Timespan(day_t value = 0); @@ -46,11 +48,13 @@ namespace OpenVic { static constexpr Timespan::day_t DAYS_IN_YEAR = 365; static constexpr Timespan::day_t DAYS_IN_MONTH[MONTHS_IN_YEAR] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; static constexpr Timespan::day_t DAYS_UP_TO_MONTH[MONTHS_IN_YEAR] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; + private: // Number of days since Jan 1st, Year 0 Timespan timespan; static Timespan _dateToTimespan(year_t year, month_t month, day_t day); + public: // The Timespan is considered to be the number of days since Jan 1st, Year 0 Date(Timespan total_days); |