aboutsummaryrefslogtreecommitdiff
path: root/src/openvic/Date.hpp
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-05-22 11:26:37 +0200
committer Hop311 <hop3114@gmail.com>2023-05-22 11:26:37 +0200
commit212d591c31f4200b06d38e98b23c5c2bccde1772 (patch)
tree6a9964038de099006036c693b49080bf544d3747 /src/openvic/Date.hpp
parent15e960f93ced8c94a6a45ebb2b44d0705ff7f8f6 (diff)
Formatting / style cleanup
Diffstat (limited to 'src/openvic/Date.hpp')
-rw-r--r--src/openvic/Date.hpp6
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);