Step 1 — Acquire sunrise & sunset (correctly)
- ✦Use the location’s timezone (including DST rules).
- ✦Use the local civil date (not UTC date labels).
Step 2 — Compute temporal hour lengths
Let sunrise, sunset, and nextSunrise be local times.
dayLen = sunset - sunrise
nightLen = nextSunrise - sunset
dayHour = dayLen / 12
nightHour = nightLen / 12Step 3 — Build the 24 boundaries
- Day hour i:
[sunrise + (i-1)*dayHour, sunrise + i*dayHour] - Night hour j:
[sunset + (j-1)*nightHour, sunset + j*nightHour]
Step 4 — Assign planetary rulers
Use the Chaldean order: Saturn → Jupiter → Mars → Sun → Venus → Mercury → Moon (repeat).
- ✦The first daylight hour starts with the weekday ruler.
- ✦Continue the sequence continuously through day and night (do not reset at midnight).
Implementation notes
- ✦Handle polar edge cases (no sunrise/sunset) gracefully.
- ✦Keep boundaries at second precision to avoid UI drift.
- ✦12h/24h is display-only; internal math stays in absolute timestamps.