commit 96a3c04ddb1201e7e13cb51d40f3e6bf1e41f79c
parent 67423a21dc838923b925bcca0648ea2e03c532ef
Author: Byron Torres <b@torresjrjr.com>
Date: Fri, 7 Jan 2022 23:04:09 +0000
rename calendrical epochal constants
Signed-off-by: Byron Torres <b@torresjrjr.com>
Diffstat:
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/datetime/calendar.ha b/datetime/calendar.ha
@@ -7,10 +7,10 @@ use time::chrono;
// as offsets from the Hare epoch.
// The Hare epoch of the Julian Day Number
-export def EPOCH_JULIAN: i64 = -2440588;
+export def EPOCHAL_JULIAN: i64 = -2440588;
-// The Hare epoch of the Common Era
-export def EPOCH_COMMONERA: i64 = -719164;
+// The Hare epoch of the Gregorian Common Era
+export def EPOCHAL_GREGORIAN: i64 = -719164;
//
@@ -19,7 +19,7 @@ export def EPOCH_COMMONERA: i64 = -719164;
// Evaluates a [[datetime]]'s number of days since the calendar epoch 0000-01-01
export fn epochal(dt: *datetime) chrono::epochal = {
- return dt.date - EPOCH_COMMONERA;
+ return dt.date - EPOCHAL_GREGORIAN;
};
// Evaluates a [[datetime]]'s era
diff --git a/datetime/date.ha b/datetime/date.ha
@@ -55,7 +55,7 @@ fn calc_ymd(e: chrono::epochal) (int, int, int) = {
// https://en.wikipedia.org/wiki/Julian_day#Julian_or_Gregorian_calendar_from_Julian_day_number
//
// Alternate methods of date calculation should be explored.
- const J = e - EPOCH_JULIAN;
+ const J = e - EPOCHAL_JULIAN;
// TODO: substitute numbers where possible
const b = 274277;
@@ -194,7 +194,7 @@ fn calc_epochal_from_ymd(y: int, m: int, d: int) (chrono::epochal | errors::inva
+ d
- 32075
);
- const e = jdn + EPOCH_JULIAN;
+ const e = jdn + EPOCHAL_JULIAN;
return e;
};