Files
el/tests/calendar/examples/dst-spring-forward.el
Will Anderson ed564b6dda add Calendar + CalendarTime + Rhythm + LocalDate/Time as first-class
Phase 1.5 of time-system. Calendar is pluggable: EarthCalendar
(IANA zones, DST, Gregorian) is the default; MarsCalendar,
CycleCalendar(period), NoCycleCalendar handle non-Earth cases.

Rhythm abstracts recurrence from clock units - rhythm_cycle_phase(0.5)
means "midpoint of cycle" whether the cycle is 24 hours on Earth or
30 hours on a station or 300 years on a long-cycle world.

Phase 1 (Instant + Duration) unchanged. EarthCalendar(zone_local())
is the user-facing default; nobody who doesn't care about non-Earth
calendars sees the abstraction.

Self-host fixed point holds at 6339 lines.
Snapshot tagged at dist/platform/elc.20260502-1321-self-host.

Phase 2 (scheduling primitives every/after/at) lands next, now with
Calendar-aware grounding instead of Earth-time hardcoded.

Backlog: bl-297f66d8 (supersedes bl-b29b3e60)
2026-05-02 13:21:43 -05:00

18 lines
615 B
EmacsLisp

// dst-spring-forward.el Earth calendar handles the DST transition.
// 2026 spring DST: March 8 at 02:00 EST clocks jump to 03:00 EDT.
// 2026-03-08 06:30 UTC = 01:30 EST (just before the jump).
// Add 1 hour 07:30 UTC = 03:30 EDT (the wall clock skipped 02:30 entirely).
fn run_test() -> String {
let z: Zone = zone("America/New_York")
let cal: Calendar = earth_calendar(z)
let i: Instant = unix_seconds(1772951400)
let later: Instant = i + 1.hour
let ct: CalendarTime = in_calendar(later, cal)
return cal_format(ct, "HH:mm z")
}
fn main() -> Void {
println(run_test())
}