CelestialCalendar 1.0.0 · unreleased development @ 67a7c4c79a4a4a6aa7e703c9e6f0039ae34bee82
Loading...
Searching...
No Matches
calendar::lunar::algo3 Namespace Reference

Functions

auto calc_lunar_year (int32_t year) -> common::LunarYear
 Calculate the lunar year information for the given year.

Variables

constexpr int32_t START_YEAR
 The first supported lunar year.
constexpr int32_t END_YEAR
 The last supported lunar year.
constexpr std::array< uint32_t,(END_YEAR - START_YEAR+1)> LUNAR_DATA
 The encoded binary data for each lunar year. Info for a year is stored in a uint32_t.
const auto bounds
 The bounds of the algorithm, i.e. the supported range of lunar and Gregorian dates.

Function Documentation

◆ calc_lunar_year()

auto calendar::lunar::algo3::calc_lunar_year ( int32_t year) ->common::LunarYear
inlinenodiscard

Calculate the lunar year information for the given year.

Attention
The input year should be in the range of [START_YEAR, END_YEAR].
Parameters
yearThe Lunar year. 阴历年份。
Returns
The lunar year information. 阴历年信息。

Variable Documentation

◆ bounds

const auto calendar::lunar::algo3::bounds
inline

The bounds of the algorithm, i.e. the supported range of lunar and Gregorian dates.

◆ END_YEAR

int32_t calendar::lunar::algo3::END_YEAR
inlineconstexpr

The last supported lunar year.

◆ LUNAR_DATA

std::array<uint32_t, (END_YEAR - START_YEAR + 1)> calendar::lunar::algo3::LUNAR_DATA
inlineconstexpr

The encoded binary data for each lunar year. Info for a year is stored in a uint32_t.

See also
https://www.hko.gov.hk/sc/gts/time/conversion.htm
Espenak and Meeus, NASA/TP-2006-214141, Section 2.7, equations (11)-(25); historical source for 398 retained non-HKO entries. https://ntrs.nasa.gov/citations/20070003587
Note
Gregorian dates use a baked hybrid basis: 1901–2099 preserves algo1's HKO labels; every other year was generated from algo2's fixed-east-eight civil rendering. No one historical time-zone rule describes the whole table. 公历日期基准是混合的:1901 至 2099 年保留 algo1 的香港天文台日期标记,其余年份由 algo2 的固定东八区民用时间生成; 不存在一条历史时区规则可以概括整张表。

Provenance (baked table – #70)

  • Generator: statistics/lunar_calendar.ipynb (encode cells: HKO years 1901–2099 via algo1 / HKO table; all other years via live algo2 — see algo2.hpp).
  • All 401 non-HKO values (1600–1900 ∪ 2100–2199) re-encode identically under live algo2. Re-bake through the same notebook whenever its time-scale dependencies change.
  • The 199 HKO entries (1901–2099) carry no ΔT dependence; they are algo1's table verbatim. Their retained HKO identity record is src/test/provenance/hko/2026-08-25/. Retained under owner risk acceptance; upstream permission was not obtained and no permission is claimed. These HKO-derived words remain under their source terms and outside the project MIT grant. Full-array re-encode against live algo2 is not zero-diff: the six known years 1914/1915/1916/1920/2057/2097 diverge (see diff_test.cpp / #64). This block is a provenance note, not a data fix: do not edit any of the 600 values here without a deliberate re-bake and review.
  • Read-only re-verification: run the "重烤对账" code cell at the end of statistics/lunar_calendar.ipynb. It re-encodes the re-bakeable subset and prints a mismatch count against this array. A zero count confirms that subset matches. The cell never writes this header back.
  • External oracle for a sampled subset of years: src/test/lunar/algo3_ytliu0_golden_test.cpp (ytliu0 ChineseCalendar, see that file's provenance head). Dual-table / live-algo2 internal checks: src/test/lunar/algo3_test.cpp.

◆ START_YEAR

int32_t calendar::lunar::algo3::START_YEAR
inlineconstexpr

The first supported lunar year.