// cycle-300yr.el — CycleCalendar with a 100-year period proves the math
// holds at long periods. (300 years exceeds int64 nanos: 2^63 ns ≈ 292 yr;
// 100 yr is the largest round period that fits while leaving headroom for
// instants on either side.) One earth year apart yields phase_diff ~ 0.01.

fn run_test() -> String {
    // 100 Julian years = 100 * 31557600 = 3155760000 seconds.
    let period: Duration = duration_seconds(3155760000)
    let cal: Calendar = cycle_calendar(period)
    let base: Instant = unix_seconds(0)
    let later: Instant = unix_seconds(31557600)
    let ct1: CalendarTime = in_calendar(base, cal)
    let ct2: CalendarTime = in_calendar(later, cal)
    let p1: Float = cal_cycle_phase(ct1)
    let p2: Float = cal_cycle_phase(ct2)
    let diff: Float = p2 - p1
    // 1 year / 100 years = 0.01
    return format_float(diff, 2)
}

fn main() -> Void {
    println(run_test())
}
