6 #ifndef ACE_TIME_EPOCH_CONVERTER_JULIAN_H
7 #define ACE_TIME_EPOCH_CONVERTER_JULIAN_H
70 static int32_t
toEpochDays(int16_t year, uint8_t month, uint8_t day) {
71 int8_t mm = (month - 14)/12;
72 int32_t jdn = ((int32_t) 1461 * (year + 4800 + mm))/4
73 + (367 * (month - 2 - 12 * mm))/12
74 - (3 * ((year + 4900 + mm)/100))/4
87 int16_t& year, uint8_t& month, uint8_t& day) {
90 uint32_t f = J + 1401 + (((4 * J + 274277 ) / 146097) * 3) / 4 - 38;
91 uint32_t e = 4 * f + 3;
92 uint32_t g = e % 1461 / 4;
93 uint32_t h = 5 * g + 2;
94 day = (h % 153) / 5 + 1;
95 month = (h / 153 + 2) % 12 + 1;
96 year = (e / 1461) - 4716 + (12 + 2 - month) / 12;
Utility class that converts AceTime epoch days to (year, month, day) in the Gregorian calendar and vi...
static int32_t toEpochDays(int16_t year, uint8_t month, uint8_t day)
Convert (year, month, day) in the Gregorian calendar to days since the internal epoch (2000-01-01).
static const int32_t kDaysToInternalEpochFromJulianEpoch
Number of days from the modified proleptic Julian calendar epoch (4713 BC 01-01, modified to start at...
static const int32_t kDaysToInternalEpochFromUnixEpoch
Number of days from Unix epoch (1970-01-01 00:00:00 UTC) to the internal epoch (2000-01-01 00:00:00 U...
static const int16_t kInternalEpochYear
Epoch year used by this epoch converter.
static void fromEpochDays(int32_t epochDays, int16_t &year, uint8_t &month, uint8_t &day)
Extract the (year, month, day) fields from AceTime epochDays.